export const persistedCustomersRx = Rx.make<
CustomerForAdminAllView["customers"]
>([]);
// ---
// tsx component
export const CustomersIndexTable = () => {
...
const shop = useRxValue(shopRx);
const [customers, customersGet] = useRx(customersRx);
const [persistedCustomers, setPersistedCustomers] =
useRx(persistedCustomersRx);
useEffect(() => {
if (persistedCustomers.length > 0) {
return;
}
customersGet({ shopId: shop.value.id });
}, []);
...
}
export const persistedCustomersRx = Rx.make<
CustomerForAdminAllView["customers"]
>([]);
// ---
// tsx component
export const CustomersIndexTable = () => {
...
const shop = useRxValue(shopRx);
const [customers, customersGet] = useRx(customersRx);
const [persistedCustomers, setPersistedCustomers] =
useRx(persistedCustomersRx);
useEffect(() => {
if (persistedCustomers.length > 0) {
return;
}
customersGet({ shopId: shop.value.id });
}, []);
...
}