Files
faunosteo/apps/app/src/state/leaveGuardStore.ts
T
bchanot b38e62770e feat(app): clients list, page, create, edit, archive and restore
Routes /app/clients, /new, /:clientId, /:clientId/edit behind a workspace
gate that remounts per workspace; debounced POST search, archived toggle and
« Afficher plus » pages; form on field-limits (D-R7) with the phone entry
rule and ISO countries; request id per creation intent; conflict shows the
saved values; archive confirmation with the sole-owner preview; animals
read-only; leave guard on in-app links; Clients entry after the dashboard.
2026-10-26 01:59:25 +01:00

17 lines
449 B
TypeScript

import { create } from 'zustand'
/**
* Whether the page holds unsaved changes the user would lose by following a
* link of the shell. Armed by useLeaveGuard; read by AppLayout, which asks
* before an in-app link click while it is armed.
*/
interface LeaveGuardState {
armed: boolean
arm: (armed: boolean) => void
}
export const useLeaveGuardStore = create<LeaveGuardState>((set) => ({
armed: false,
arm: (armed) => set({ armed }),
}))