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

Fix the logical flux control on WebUrlService Class - FLutterWeb #963

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rfmeloneto
Copy link

@rfmeloneto rfmeloneto commented Jul 26, 2024

Description

This bugs happens on FlutterWeb and when the initalRoute is "/"

The bug happens on FlutterWeb when you click on a link that contains a path after '#' or paste it on browser and the link ends with "/" and your initialRoute is "/" then the window reloads and redirects you to the home screen.

The reason for this bug is because on the WebUrlService, the logical check for UrlStrategy, first checks if the href ends with initialRoute, and because the link ends with "/" and the initalRoute is "/" the condition is satisfied and the user is redirected to the home screen and not to the desired destination.
To fix that, this PR only inverts the logic of the UrlStrategy check. The logic on this PR first checks if the href contains '#' than if it ends with initialRoute.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

This PR can solve the bug related on issue #834

And i think it can solve the issue #956

@GustavoFigueira
Copy link

Someone to approve this PR please? This fikes the broken Modular.setInitialRoute on Flutter's last version (3.24.1) with flutter_modular last version (6.3.4).

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 this pull request may close these issues.

2 participants