Skip to content

67 add candeactivate guard support#83

Draft
iObject wants to merge 20 commits into
95-add-replace-supportfrom
67-add-candeactivate-guard-support
Draft

67 add candeactivate guard support#83
iObject wants to merge 20 commits into
95-add-replace-supportfrom
67-add-candeactivate-guard-support

Conversation

@iObject
Copy link
Copy Markdown
Collaborator

@iObject iObject commented Mar 12, 2026

No description provided.

@iObject iObject linked an issue Mar 12, 2026 that may be closed by this pull request
@iObject iObject self-assigned this Mar 12, 2026
@iObject iObject added the enhancement New feature or request label Mar 12, 2026
@iObject iObject requested a review from Copilot March 12, 2026 15:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 canDeactivate to route configs and enforce it during navigateTo and goBack.
  • Add/extend test coverage around canDeactivate navigation allow/block behavior.
  • Update the sample test-project to include a toggleable CanDeactivateManager plus 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.

Comment thread test-project/components/Screens/Welcome/WelcomeScreen.bs
Comment thread src/components/Router.bs Outdated
Comment thread src/source/router.spec.bs
Comment thread src/components/test/TestCanActivateGuard.bs
Comment thread src/components/test/TestCanActivateRedirectGuard.bs Outdated
Comment thread src/components/test/TestCanDeactivateGuard.bs Outdated
@iObject iObject requested a review from Copilot March 12, 2026 15:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
iObject and others added 2 commits March 12, 2026 12:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/source/router.spec.bs
Comment thread src/components/test/TestCanDeactivateGuard.bs Outdated
Comment thread src/components/test/TestCanActivateGuard.bs Outdated
Comment thread src/components/test/TestCanActivateRedirectGuard.bs
Comment thread src/source/interfaces.bs Outdated
iObject and others added 6 commits March 12, 2026 12:23
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/components/Router.bs Outdated
Comment thread src/components/Router.bs Outdated
Comment thread src/components/test/TestCanActivateGuard.bs
Comment thread src/components/Router.bs Outdated
@iObject iObject marked this pull request as draft March 13, 2026 12:56
@iObject iObject changed the base branch from master to 95-add-replace-support March 16, 2026 22:06
@iObject iObject added the create-package create a temporary npm package on every commit label Mar 17, 2026
@rokucommunity-bot
Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-package create a temporary npm package on every commit enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add canDeactivate guard support

2 participants