Don't retain parameters not passed as query string parameters #14965
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
Currently when you pass extra parameters to shell via the parameters dictionary those are retained forever and reapplied with each navigation. The workarounds to remove those parameters is fairly cumbersome. Through discussions with users, it's become apparent that we need a mechanism to have parameters that only get applied during the initial navigation request. This PR clears any parameters that aren't part of the QueryString.
It's particularly problematic to retain those parameters because if the user passes a complex object that object is retained in memory forever unknown to the user.
FAQ
OnAppearing
?Breaking Change
ApplyQueryAttributes
will only be called with the parameters that are part of the query string of that route. This also means that properties defined inQueryPropertyAttribute
will only be set if they are part of the query string.Examples for the docs to improve clarity
We should enhance the navigation part of the
Shell
docs to include various example permutations of how parameters are handled.Still works the same
Breaking Change
Issues Fixed
Fixes #10294
Alternative Approaches
Add an enumeration to
Shell
so users can control the life cycle.Issues
Add a new overload for shell GotoAsync that differentiates navigation parameters vs query parameters.
Issues