Greater-London-Authority / ldn-viz-tools

https://greater-london-authority.github.io/ldn-viz-tools/
1 stars 0 forks source link

Components using '$app/...' should be refactored #202

Closed ChrisKnightLDN closed 5 months ago

ChrisKnightLDN commented 8 months ago

Components assuming the availibility of '$app/...' cause issues in non sveltekit apps (ie. storybook): Cannot read properties of undefined (reading 'url').

see: https://kit.svelte.dev/docs/packaging#best-practices

"You should avoid using SvelteKit-specific modules like $app in your packages unless you intend for them to only be consumable by other SvelteKit projects. E.g. rather than using import { browser } from '$app/environment' you could use import { BROWSER } from 'esm-env' (see esm-env docs). You may also wish to pass in things like the current URL or a navigation action as a prop rather than relying directly on $app/stores, $app/navigation, etc. Writing your app in this more generic fashion will also make it easier to setup tools for testing, UI demos and so on."

jamesscottbrown commented 5 months ago

This was resolved in #289