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

feat: disable URL state sync option when running in datasette-lite #29

Closed
hydrosquall opened this issue Aug 27, 2022 · 1 comment
Closed

Comments

@hydrosquall
Copy link
Owner

hydrosquall commented Aug 27, 2022

Motivation

Background

  • feat: proof of concept initialization hook for instantiating JS plugins in datasette-lite #26 is mostly working, with caveats
    • Reusing the URL hash currently confuses the datasette lite router. In regular datasette, this route is not sent to the server. In datasette lite, this information is used to simulate the server
    • Until we figure out a way to separate URL search params / URL hash, or add a pure JS API for doing browser routing in datasette-lite, it's best to disable the "save URL state" feature entirely when running in datasette-lite mode.

Implementation Notes

  • We could make controlling this part of Datasette plugin config in the long term
  • In the short term, in the interest of having a good default experience "out of the box", I think I'll use awareness of running in the datasette lite environment to pass a param into onLoad.

if ((window as any).__IS_DATASETTE_LITE__) {
document.addEventListener("DatasetteLiteScriptsLoaded", onLoad);
}

When this setting is disabled, we can ignore the Jotai hook.

const [explorerMetadata, setExplorerMetadata ] = useAtom(explorerMetadataAtom);

@hydrosquall hydrosquall changed the title feat: disabling the URL state sync option when running in datasette-lite feat: disable URL state sync option when running in datasette-lite Aug 27, 2022
@hydrosquall
Copy link
Owner Author

Fixed for most workflows in #30 .

Can reopen if/when nteract/data-explorer#83 is completed to also handle the case where interacting with the "table" component's filters could modify URL params too.

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

No branches or pull requests

1 participant