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

Relative beaming ignore new routeState #623

Closed
Panz99 opened this issue Jun 28, 2023 · 1 comment · Fixed by #624
Closed

Relative beaming ignore new routeState #623

Panz99 opened this issue Jun 28, 2023 · 1 comment · Fixed by #624

Comments

@Panz99
Copy link
Contributor

Panz99 commented Jun 28, 2023

Describe the bug
Using relative beaming to navigate, if some new routestate are provided they're ignored. So che beaminglocation routestate can't be updated.

Beamer version: 1.5.3

To Reproduce
Steps to reproduce the behavior:
Having a BeamLocation with this path : '/main/child'

  1. use beamToNamed to '/main' with routeState: {anydata: 'hello'}
  2. navigate using beamToNamed with relative beaming like: beamToNamed('child') with new routeState: {anydata: 'world'}
  3. the state of the current beamLocation is still {anydata: 'hello'}

Expected behavior
The state now should be {anydata: 'world'}

Desktop (please complete the following information):
-any

Smartphone (please complete the following information):
-any

Additional context
This problem happens only if we use a relative beaming.
If we do beamToNamed('/main/child') with new routeState, the state is correctly updated.
The problem is on the function maybeAppend of utils.dart, there the routeinformations are merged to handle the relative beaming, but the state is ignored.

static RouteInformation maybeAppend( RouteInformation current, RouteInformation incoming, ) { final incomingLocation = incoming.location; if (incomingLocation == null) { return current.copyWith(); } if (!incomingLocation.startsWith('/')) { return current.copyWith( location: current.location?.endsWith('/') ?? false ? '${current.location}$incomingLocation' : '${current.location}/$incomingLocation', ); } return incoming; }

@slovnicki slovnicki linked a pull request Jun 29, 2023 that will close this issue
@slovnicki
Copy link
Owner

slovnicki commented Jun 29, 2023

Thanks for the PR #624! 💙

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

Successfully merging a pull request may close this issue.

2 participants