NativeScript / NativeScript/angular

Navigation and nested page-router-outlet with lazy loaded children

Open
#57 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
55
Forks
13
Avg merge
16m
Merged PRs (30d)
1

Description

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 8.1.5
  • Cross-platform modules: 8.1.5
  • Android Runtime: 8.1.0
  • iOS Runtime: 8.1.1
  • Plugin(s): "@nativescript-community/ui-material-bottom-navigation": "~6.2.13"
  • NativeScript-Angular: 13.0.2
  • Angular: 13.1.1

Describe the bug

Navigation for a page-router-outlet is not working anymore after navigating back from details view.

I have a navigation setup with nested page-router-outlets, much like this example, except the children (player details and team details) are also lazy loaded modules with their own routes.

After starting the app, and the tabs are loaded with their lazy loaded module, I can navigate to the details view and back. However, when I try to navigate to the details view again, there's no response. I have enabled tracing on the router, and there are no events fired when navigating back. Also no events are fired on new navigation attempts.

If I navigate to another tab, I can repeat the process. Then that will be "stuck" as well.

To Reproduce
Use the example from the link above and lazy load the details components.

Expected behavior
Navigation should keep working regardless of lazy loaded children.

Sample project

Additional context

This was working in @nativescript/angular 13.0.1, but then with issues like #49 and #53

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked ns-login-tab-navigation-ng13 example and adapt its nested page-router-outlet setup so player and team details are lazy-loaded. Compare behavior between @nativescript/angular 13.0.1 and 13.0.2 while tracing router events; done means navigating to details and back repeatedly continues to work across tabs.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.