chore: redirect to last visited market - improve use of zustand
This commit is contained in:
@@ -13,10 +13,8 @@ export const Home = () => {
|
||||
const { data, error, loading } = useDataProvider({
|
||||
dataProvider: marketsWithDataProvider,
|
||||
});
|
||||
const { update, marketId } = useGlobalStore((store) => ({
|
||||
update: store.update,
|
||||
marketId: store.marketId,
|
||||
}));
|
||||
const update = useGlobalStore((store) => store.update);
|
||||
const marketId = useGlobalStore((store) => store.marketId);
|
||||
|
||||
useEffect(() => {
|
||||
if (marketId) {
|
||||
|
||||
@@ -36,15 +36,11 @@ export const Market = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { w } = useWindowSize();
|
||||
const { update, marketId: lastMarketId } = useGlobalStore((store) => ({
|
||||
update: store.update,
|
||||
marketId: store.marketId,
|
||||
}));
|
||||
const update = useGlobalStore((store) => store.update);
|
||||
const lastMarketId = useGlobalStore((store) => store.marketId);
|
||||
|
||||
const { pageTitle, updateTitle } = usePageTitleStore((store) => ({
|
||||
pageTitle: store.pageTitle,
|
||||
updateTitle: store.updateTitle,
|
||||
}));
|
||||
const pageTitle = usePageTitleStore((store) => store.pageTitle);
|
||||
const updateTitle = usePageTitleStore((store) => store.updateTitle);
|
||||
|
||||
const onSelect = useCallback(
|
||||
(id: string) => {
|
||||
|
||||
Reference in New Issue
Block a user