67 add candeactivate guard support#83
Conversation
There was a problem hiding this comment.
Pull request overview
Adds canDeactivate guard support to sgRouter so navigation away from the current route can be conditionally blocked (including goBack), and updates the sample app + tests to exercise the new behavior.
Changes:
- Add
canDeactivateto route configs and enforce it duringnavigateToandgoBack. - Add/extend test coverage around canDeactivate navigation allow/block behavior.
- Update the sample
test-projectto include a toggleableCanDeactivateManagerplus a small HUD indicator.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test-project/components/Screens/Welcome/WelcomeScreen.bs | Adjusts login button behavior in the sample app. |
| test-project/components/Scene/MainScene/MainScene.xml | Adds a HUD group/label for canDeactivate status. |
| test-project/components/Scene/MainScene/MainScene.bs | Adds global CanDeactivateManager, wires HUD updates, routes get canDeactivate, and toggles enabled via Replay key. |
| test-project/components/Managers/CanDeactivate/CanDeactivateManager.xml | Introduces a new manager node with enabled and canDeactivate(). |
| test-project/components/Managers/CanDeactivate/CanDeactivateManager.bs | Implements canDeactivate() returning the enabled state. |
| src/source/router.spec.bs | Updates route config expectations and adds canDeactivate-focused tests. |
| src/source/interfaces.bs | Extends RouteConfig typing to include canDeactivate. |
| src/components/test/TestCanDeactivateGuard.bs | Adds a test guard implementation (but currently missing its component XML). |
| src/components/test/TestCanActivateRedirectGuard.bs | Adds a redirect guard implementation (but currently missing its component XML). |
| src/components/test/TestCanActivateGuard.bs | Adds a basic canActivate test guard (but currently missing its component XML). |
| src/components/Router.bs | Core implementation: default canDeactivate, enforce deactivation guards in navigateTo + goBack, update NavigationCancel handling. |
| bsconfig.json | Excludes components/test/** from the main build output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey there! I just built a new temporary npm package based on 7d9dac7. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/sgRouter/releases/download/v0.0.0-packages/rokucommunity-sgrouter-0.1.2-67-add-candeactivate-guard-support.20260317120002.tgz |
No description provided.