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

UrlSync: Variable changes adds browser history steps #882

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

torkelo
Copy link
Member

@torkelo torkelo commented Aug 29, 2024

This works on top of #878

and explores adding browser history steps for variables.

Works surprisingly well. The challenge here is that not all variable value changes should create URL history steps.

Given a valid state of datacenter=US , cluster=US-1

  • when changing datacenter=EU
  • then cluster will maybe change to "EU-1" we should not record a browser history step for this change as that would create a back step for datacenter=EU cluster=US-1 (which is invalid)

To solve this we need to differentiate between variable changes that are due to user actions and those that come due to parent variable change. which is why I am adding isUserAction bool to changeValueTo

works surprisingly well

@@ -428,6 +446,16 @@ export class MultiValueUrlSyncHandler<TState extends MultiValueVariableState = M
this._sceneObject.changeValueTo(urlValue);
}
}

public performBrowserHistoryAction(callback: () => void) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🎉 Do you think it could be the default behavior of SceneObjectUrlSyncConfig and AdHocFiltersVariableUrlSyncHandler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, probably. pushed an update to #878 that adds it to SceneObjectUrlSyncConfig

Base automatically changed from url-sync-bigger-change to main September 4, 2024 13:38
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