[ PE-294 ] fix : route back on page delete#6729
Conversation
WalkthroughThis pull request updates the Changes
Sequence Diagram(s)sequenceDiagram
participant Modal as DeletePageModal
participant Router as AppRouter
participant API as Server/API
Modal->>API: Request page deletion
API-->>Modal: Confirm deletion
Modal->>Modal: Extract routePageId using useParams
alt routePageId exists
Modal->>Router: Execute router.back()
else
Modal->>Modal: Skip navigation step
end
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
web/core/components/pages/modals/delete-page-modal.tsx (1)
62-64: Good implementation of navigation after page deletion.The addition of the conditional navigation logic after successful page deletion addresses the issue where users were experiencing fetch errors after deleting a page. Using
router.back()is an appropriate solution as it returns users to their previous location.Consider adding a fallback navigation path for cases where
router.back()might not work as expected (e.g., if users directly navigated to the page via a bookmark or direct URL). For example:if (routePageId) { router.back(); +} else { + // Fallback to a safe location like the pages list + router.push("/workspace-path/pages"); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/core/components/pages/modals/delete-page-modal.tsx(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (1)
web/core/components/pages/modals/delete-page-modal.tsx (1)
6-6: Added navigation imports and hooks look good.The new imports and hooks provide the necessary functionality to access the router and URL parameters, which are essential for implementing the navigation after page deletion.
Also applies to: 13-13, 41-42
Description
Deleting a page from within doesn’t redirect the user, leading to a fetch error. This fix ensures proper redirection.
Type of Change
Screenshots and Media (if applicable)
Before
Screen.Recording.2025-03-10.at.4.47.18.PM.mov
After
Screen.Recording.2025-03-10.at.4.46.54.PM.mov
Summary by CodeRabbit