Is there a way of Sharing a URL for a panel's state?

Some times a user of a panel dashboard has set all the widgets to display a eureka plot of their data.
They would then like to share an URL that captures that eureka state of the panel. When the URL is resolved, it returns a new instance of the panel dashboard in that eureka state.

I think creating this URL would involve encoding the state of all the widgets in the URL, something like:
https://www.test.com/panel.py?widget1=value1&widget2=value2

When the panel restarts, it extract the initial values of the widgets using:
pn.state.session_args:

Is there a function or shortcut to save the state of all of a panel’s widgets?

1 Like

This has been merged into master but not released yet. See https://github.com/holoviz/panel/pull/1150

I’ve contributed a Location component that will enable updating the url with parameters and reacting to changes in the url. @philippjfr has improved this.

The one thing remaining is “serializing” the parameters of a param.Parameterized class into the parameter part of the url and vice versa. But this is standard python functionality (I don’t remember where though :-))

I really need the Location component. Would be so powerful for my users to be able to bookmark and share links to the exact state of their apps and views.

This was merged as part of the Location component. Specifically you can call pn.state.location.sync(parameterized, parameters) and the declared parameters will be bi-directionally synced with the URL.

1 Like

The sync functionality sounds so cool @philippjfr. Can I change the parameterized and parameters when I change my “page” in an application with multiple pages?

Depends on what you consider a page in your case a “page” is still the same app right? I think you might have to unsync in that case (which is functionality I’d have to add).

1 Like

Yes its the same app @philippjfr

Okay, would you mind filing an issue about an unsync method?

Done: https://github.com/holoviz/panel/issues/1335

Thank you, you guys.
I see that pn.state.location is briefly described in the current check in of the panel documentation.

If you have suggestions on improving the visibility of that documentation and/or want to make a PR that would be super helpful. Examples that use the functionality would also be super helpful.