Closed Sten435 closed 6 months ago
@slovnicki any updates ?
Found a solution.
Do not register, any providers in the builder(...) function in the location.
Instead if you want to wrap every page with a provider,
Extend beampage and wrap your providers arround the child proppety.
This works but is not pretty.
It should be fixed in beamer itself.
It also seems to help to put the transitionDelegates to: NoAnimationTransitionDelegate()
For example:
static Future<void> ensureInitialized() async {
final appOptions = CoreAppOptions.instance;
delegate = BeamerDelegate(
initialPath: appOptions.initialPathOfApp,
stackBuilder: (routeInformation, beamParameters) {
CoreAppBeamerDelegate.beamParameters = beamParameters;
CoreAppBeamerDelegate.routeInformation = routeInformation;
return BeamerStackBuilder(
beamStacks: [
CoreAuthLocation(),
CoreEnvironmentLocation(),
CoreProfileLocation(),
CoreSettingsLocation(),
...appOptions.locations(),
],
).call(routeInformation, beamParameters);
},
routeListener: (routeInformation, beamerDelegate) {
if (kDebugMode) {
debugPrint('Navigate to ---> ${routeInformation.uri}');
}
},
// HERE
beamBackTransitionDelegate: const CoreNoAnimationTransitionDelegate(),
transitionDelegate: const CoreNoAnimationTransitionDelegate()
// HERE,
notFoundPage: const BeamPage(type: BeamPageType.noTransition, child: CoreNotFoundScreen(), key: ValueKey('tools.notFoundPage.NotFound')),
);
}
Describe the bug When navigation to a different beam location, the current page you are on (the location where you are navigating away from) is re-build 1 more time.
Since I put my Bloc Providers in each beam location and I navigate to location B from location A and the current page of location A is rebuilt right before navigating (for some reason this happens). I get a (bloc) provider not found exception.
Beamer version: beamer: ^1.6.1
To Reproduce
To temp fix this is my code, I do a
if(context.watch<Foo?> == null) return SizedBox.shrink();
.Expected behavior Navigate from beam location A to beam location B without rebuilding the beamPage 'homePage' after beamToNamed is called.
Desktop (please complete the following information):