Show a loading bar when checkout is happening (#249)

This commit is contained in:
Will Chen
2025-05-26 11:51:00 -07:00
committed by GitHub
parent 2bb8902b08
commit cdf2f5d772
5 changed files with 65 additions and 2 deletions

15
src/store/appAtoms.ts Normal file
View File

@@ -0,0 +1,15 @@
import { atom } from "jotai";
/**
* Atom to store the number of active checkoutVersion mutations.
* This is a "primitive" atom that you will update directly.
*/
export const activeCheckoutCounterAtom = atom(0);
/**
* Derived atom that is true if any checkoutVersion mutation is in progress.
* This atom is read-only and derives its state from activeCheckoutCounterAtom.
*/
export const isAnyCheckoutVersionInProgressAtom = atom(
(get) => get(activeCheckoutCounterAtom) > 0,
);