Skip to content

Commit

Permalink
Merge pull request #277 from zimmerman-team/feat/DX-2101
Browse files Browse the repository at this point in the history
feat: persist sort by state in external data search
  • Loading branch information
Psami-wondah authored Dec 10, 2024
2 parents 580b2b2 + 82b61b6 commit dcfb96a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import axios from "axios";
import CircleLoader from "app/modules/home-module/components/Loader";
import { useInfinityScroll } from "app/hooks/useInfinityScroll";
import SourceCategoryList from "app/modules/dataset-module/routes/upload-module/component/externalSourcesList";
import { useSetRecoilState } from "recoil";
import { planDialogAtom } from "app/state/recoil/atoms";
import { useRecoilState, useSetRecoilState } from "recoil";
import { externalDataSortByAtom, planDialogAtom } from "app/state/recoil/atoms";
import SaveAltIcon from "@material-ui/icons/SaveAlt";
import ExternalSearchTable from "app/modules/dataset-module/routes/upload-module/component/table/externalSearchTable";
import { useCheckUserPlan } from "app/hooks/useCheckUserPlan";
Expand Down Expand Up @@ -46,7 +46,8 @@ export default function ExternalSearch(props: {
const observerTarget = React.useRef(null);
const [view, setView] = React.useState<"grid" | "table">("grid");

const [sortValue, setSortValue] = React.useState("name");
// const [sortValue, setSortValue] = React.useState("name");
const [sortValue, setSortValue] = useRecoilState(externalDataSortByAtom);
const token = useStoreState((state) => state.AuthToken.value);
const [loading, setLoading] = React.useState(false);
const [offset, setOffset] = React.useState(0);
Expand Down
8 changes: 8 additions & 0 deletions src/app/state/recoil/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export const allAssetsSortBy = atom<"name" | "updatedDate" | "createdDate">({
effects_UNSTABLE: [persistAtom],
});

export const externalDataSortByAtom = atom<
"name" | "updatedDate" | "createdDate"
>({
key: "externalDataSortByAtom",
default: "updatedDate",
effects_UNSTABLE: [persistAtom],
});

export const homeDisplayAtom = atom<"all" | "data" | "charts" | "reports">({
key: "homeDisplayAtom",
default: "all",
Expand Down

0 comments on commit dcfb96a

Please sign in to comment.