-
Notifications
You must be signed in to change notification settings - Fork 5
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
[#1238] Create a derived atom for dataset hydration from Next.js #1266
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -32,6 +33,8 @@ const tourProviderStyles = { | |||
}; | |||
|
|||
export default function ExplorationAndAnalysisContainer() { | |||
const setExternalDatasets = useSetAtom(externalDatasetsAtom); | |||
setExternalDatasets(allExploreDatasets); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current approach using setExternalDatasets
works, but it might need to be called in multiple places where we depend on the static datasets.
I was wondering if a more scalable solution would be to use our existing EnvConfigProvider
and evolve it into a more general ConfigProvider
. Like this it would centralize both our env and data configuration in one place.
The provider could be used like this (note the extra datasets prop passed):
<EnvConfigProvider
config={{
envMapboxToken: process.env.NEXT_PUBLIC_MAPBOX_TOKEN ?? '',
envApiStacEndpoint: process.env.NEXT_PUBLIC_API_STAC_ENDPOINT ?? '',
envApiRasterEndpoint: process.env.NEXT_PUBLIC_API_RASTER_ENDPOINT ?? '',
datasets: static-datasets
}}
>
{children}
</EnvConfigProvider>
And internally, the provider would handle dataset hydration:
const setExternalDatasets = useSetAtom(externalDatasetsAtom);
setExternalDatasets(allExploreDatasets);
Like that the setter won't have to be manually called several times if it's needed.
Related Ticket: #1238
Related Next.js PR: developmentseed/next-veda-ui#17
Description of Changes
externalDatasetsAtom
to store datasets from host applications (eg Next.js)datasetLayersAtom
to use external datasets instead of the bundled static datasets from VEDA UINotes & Questions About Changes
{Add additonal notes and outstanding questions here related to changes in this pull request}
Validation / Testing
VEDA UI
Next.js