Fix page dedup cache, redirect title icon lookup, and missing isRedirect#93
Fix page dedup cache, redirect title icon lookup, and missing isRedirect#93cicalese wants to merge 1 commit intofix-redirectfrom
Conversation
|
The CI failure appears to be unrelated. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds explicit Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
resources/js/ApiPageConnectionRepo.js (1)
28-33:⚠️ Potential issue | 🟠 MajorDelay
_addedPagesmutation until successful fetch.Line 28 marks pages as added before
_queryLinkssucceeds. If the API call fails, lateraddConnectionscalls will skip those pages, preventing retry.💡 Proposed fix
- return new Promise( - function(resolve) { + return new Promise( + function(resolve, reject) { let pagesToAdd = pageNames.filter(page => !this._addedPages.includes(page)); if (pagesToAdd.length === 0) { resolve({pages: [], links: []}); } else { - this._addedPages = this._addedPages.concat(pagesToAdd); - - this._queryLinks(pagesToAdd).done( - function(apiResponse) { - this._apiResponseToPagesAndLinks(apiResponse).then(connections => resolve(connections)) - }.bind(this) - ); + this._queryLinks(pagesToAdd) + .done(function(apiResponse) { + this._apiResponseToPagesAndLinks(apiResponse).then(function(connections) { + this._addedPages = this._addedPages.concat(pagesToAdd); + resolve(connections); + }.bind(this)); + }.bind(this)) + .fail(function(err) { + reject(err); + }); } }.bind(this) );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@resources/js/ApiPageConnectionRepo.js` around lines 28 - 33, The code mutates this._addedPages before the API call succeeds, causing failed _queryLinks calls to still mark pages as added and block retries; change addConnections flow so you only update this._addedPages after _queryLinks and _apiResponseToPagesAndLinks succeed: call this._queryLinks(pagesToAdd).done(...).then or use the returned promise to run this._apiResponseToPagesAndLinks and on successful resolution concat pagesToAdd into this._addedPages (or set it) and then resolve with connections; on error do not modify this._addedPages and propagate/reject the error so retries remain possible (identify and update the logic in addConnections that currently mutates _addedPages, and adjust the success handler around _queryLinks and _apiResponseToPagesAndLinks accordingly).
🧹 Nitpick comments (1)
resources/js/ApiPageConnectionRepo.js (1)
65-67: UseresolvedTitleas fallback fordisplayTitle.On Line 66, fallback to
page.titlecan re-show the redirect source even after resolution. PreferresolvedTitlefor consistency.💡 Proposed fix
- page.displayTitle = displayTitles[resolvedTitle] || page.title; + page.displayTitle = displayTitles[resolvedTitle] || resolvedTitle;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@resources/js/ApiPageConnectionRepo.js` around lines 65 - 67, When setting page.displayTitle, use the resolvedTitle as the fallback instead of page.title to avoid showing the original redirect source; change the assignment that reads page.displayTitle = displayTitles[resolvedTitle] || page.title to use resolvedTitle (i.e., page.displayTitle = displayTitles[resolvedTitle] || resolvedTitle) so displayTitles lookups fall back to the resolved value consistently (affects the block where resolvedTitle, displayTitles and page.displayTitle are used).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@resources/js/ApiPageConnectionRepo.js`:
- Around line 28-33: The code mutates this._addedPages before the API call
succeeds, causing failed _queryLinks calls to still mark pages as added and
block retries; change addConnections flow so you only update this._addedPages
after _queryLinks and _apiResponseToPagesAndLinks succeed: call
this._queryLinks(pagesToAdd).done(...).then or use the returned promise to run
this._apiResponseToPagesAndLinks and on successful resolution concat pagesToAdd
into this._addedPages (or set it) and then resolve with connections; on error do
not modify this._addedPages and propagate/reject the error so retries remain
possible (identify and update the logic in addConnections that currently mutates
_addedPages, and adjust the success handler around _queryLinks and
_apiResponseToPagesAndLinks accordingly).
---
Nitpick comments:
In `@resources/js/ApiPageConnectionRepo.js`:
- Around line 65-67: When setting page.displayTitle, use the resolvedTitle as
the fallback instead of page.title to avoid showing the original redirect
source; change the assignment that reads page.displayTitle =
displayTitles[resolvedTitle] || page.title to use resolvedTitle (i.e.,
page.displayTitle = displayTitles[resolvedTitle] || resolvedTitle) so
displayTitles lookups fall back to the resolved value consistently (affects the
block where resolvedTitle, displayTitles and page.displayTitle are used).
Fix issues found by CodeRabbit in #92 - Assign concat result back to _addedPages so the dedup cache actually grows across addConnections calls - Build a redirect map from the API response and use it to resolve title icon lookups for redirected pages - Add isRedirect: false to outgoing and external link page entries for consistency with central page and incoming link entries
e331ff7 to
1e982d9
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@JeroenDeDauw This should be ready to merge pending your review. |
Fix issues found by CodeRabbit in #92
Summary by CodeRabbit
Bug Fixes
Refactor