Skip to content

Commit

Permalink
Hydrate the new atom for backwards compatibility in the VEDA UI as well
Browse files Browse the repository at this point in the history
  • Loading branch information
dzole0311 committed Nov 21, 2024
1 parent a5c2b3c commit 41a3a48
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/scripts/components/exploration/container.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useState } from 'react';
import { TourProvider } from '@reactour/tour';
import { DevTools } from 'jotai-devtools';
import { useAtom } from 'jotai';
import { useAtom, useSetAtom } from 'jotai';
import { PopoverTourComponent, TourManager } from './tour-manager';

import { DatasetSelectorModal } from './components/dataset-selector-modal';
import { allExploreDatasets } from './data-utils';
import useTimelineDatasetAtom from './hooks/use-timeline-dataset-atom';
import { externalDatasetsAtom } from './atoms/datasetLayers';
import ExplorationAndAnalysis from '.';
import { urlAtom } from '$utils/params-location-atom/url';
import { DATASETS_PATH, EXPLORATION_PATH } from '$utils/routes';
Expand All @@ -32,6 +33,8 @@ const tourProviderStyles = {
};

export default function ExplorationAndAnalysisContainer() {
const setExternalDatasets = useSetAtom(externalDatasetsAtom);
setExternalDatasets(allExploreDatasets);
const [timelineDatasets, setTimelineDatasets] = useTimelineDatasetAtom();
const [datasetModalRevealed, setDatasetModalRevealed] = useState(
!timelineDatasets.length
Expand All @@ -40,8 +43,8 @@ export default function ExplorationAndAnalysisContainer() {
// @NOTE: When Exploration page is preloaded (ex. Linked with react-router)
// atomWithLocation gets initialized outside of Exploration page and returns the previous page's value
// We check if url Atom actually returns the values for exploration page here.
const [currentUrl]= useAtom(urlAtom);
if(!currentUrl.pathname?.includes(EXPLORATION_PATH)) return null;
const [currentUrl] = useAtom(urlAtom);
if (!currentUrl.pathname?.includes(EXPLORATION_PATH)) return null;

const openModal = () => setDatasetModalRevealed(true);
const closeModal = () => setDatasetModalRevealed(false);
Expand Down

0 comments on commit 41a3a48

Please sign in to comment.