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
[x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
[X] I have read the Contributor Guide and followed the process outlined for submitting PRs.
[X] 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.
Someone to approve this PR please? This fixes the broken Modular.setInitialRoute on Flutter's last version (3.24.1) with flutter_modular last version (6.3.4).
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
fix:
,feat:
,docs:
etc).docs
and added dartdoc comments with///
.examples
.Breaking Change
Related Issues
This PR can solve the bug related on issue https://github.com/Flutterando/modular/issues/834
And i think it can solve the issue https://github.com/Flutterando/modular/issues/956