Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChildRoute fails to render if it has RouterOutlet #932

Open
bandinopla opened this issue Jan 26, 2024 · 0 comments
Open

ChildRoute fails to render if it has RouterOutlet #932

bandinopla opened this issue Jan 26, 2024 · 0 comments
Labels
new New issue request attention

Comments

@bandinopla
Copy link

Describe the bug
This example never updates the title if you use RouterOutlet and the urls have childrens.

class AppModule extends Module {
  @override
  void binds(i) {}

  @override
  void routes(r) {
    r.child('/test/:dummy',
        child: (context) => Column(
              children: [
                Text("This title never changes = ${r.args.params["dummy"]}"), //<--- NEVER CHANGES
                ElevatedButton(
                  onPressed: () => Modular.to.navigate('/test/cat/info'),
                  child: const Text('Navigate to /test/cat/info'),
                ),
                ElevatedButton(
                  onPressed: () => Modular.to.navigate('/test/dog/info'),
                  child: const Text('Navigate to /test/dog/info'),
                ),
                Expanded(child: RouterOutlet()) //<--- if you comment this line and remove the "/info" form the naviate urls it works.
              ],
            ),
        children: [
          ChildRoute('/info', child: (context) => Text("Info")),
          ChildRoute('/log', child: (context) => Text("log")),
        ]);
  }
}

I would expect the "child" builder from the '/test/:dummy' to be called each time the ":dummy" changes. But it doesn't do that if it has child routes...

this works if you remove the RouterOutlet

    r.child('/test/:dummy',
        child: (context) => Column(
              children: [
                Text(
                    "This title never changes = ${r.args.params["dummy"]}"), //<<--
                ElevatedButton(
                  onPressed: () => Modular.to.navigate('/test/cat'),
                  child: const Text('Navigate to /test/cat/info'),
                ),
                ElevatedButton(
                  onPressed: () => Modular.to.navigate('/test/dog'),
                  child: const Text('Navigate to /test/dog/info'),
                ),
                //Expanded(child: RouterOutlet())
              ],
            ),
        // children: [
        //   ChildRoute('/info', child: (context) => Text("Info")),
        //   ChildRoute('/log', child: (context) => Text("log")),
        // ]
        );

Environment
flutter_modular: 6.3.2
provider: ^6.0.0

@bandinopla bandinopla added the new New issue request attention label Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New issue request attention
Projects
None yet
Development

No branches or pull requests

1 participant