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

Multiple widgets used the same GlobalKey when nesting VNesters #203

Open
momrak opened this issue Sep 9, 2022 · 3 comments
Open

Multiple widgets used the same GlobalKey when nesting VNesters #203

momrak opened this issue Sep 9, 2022 · 3 comments

Comments

@momrak
Copy link

momrak commented Sep 9, 2022

Issue type: Question
Platform: Web

I have an app which produces this when trying to add a nested nesters. I assume this might be related to this #77 (comment) ? I have also seen other issues here mentioning roughly the same, but I still don't really understand why this happens.

Do you have a general explanation for these kind of issues? I am trying to wrap my head around navigation in Flutter, so might be that I have completely misunderstood my issue as well :) hehe

[VRouter: INFO] Successfully navigated to "/family/fid1234/person/pers123/prop/prop123/prop2/prop1234" using VRouter.to �[0m
nesten builder 1
nested builder 2
nesten builder 1
nested builder 2
nested builder 2
nested builder 2
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.
The key [LabeledGlobalKey<NavigatorState>#96b66 VNesterPageBase of name null and key null
navigatorKey] was used by multiple widgets. The parents of those widgets were different widgets that
both had the following description:
  Builder
A GlobalKey can only be specified on one widget at a time in the widget tree.

The first time I go to the path this works, but when navigating to new path where only some of the pathparams from the first path has been updated I get what you see here. Even though there is only one Successfully navigated to... entry it enters the builder two times.

@peazz
Copy link

peazz commented Oct 1, 2022

Currently getting this as well,

let’s say I go to /route/:routeId/dashboard where routeId is 123.

if I context.vRouter.to(‘/route/345/dashboard’) I get the same error and my screen goes blank where the view should loads.

Clearly; the nester is is trying to load the same view and not assigning a new key despite the route changing and a new instance of the class existing.

@rohitranjan1991
Copy link

@lulupointu any fix or workaround for this ??

@lulupointu
Copy link
Owner

Sorry about this issue I must have missed it.

This is certainly an issue with the key that sometimes has to be used in VNester.
Could someone produce a small reproducible example so that I can easily help you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants