first commit

This commit is contained in:
2026-09-25 16:31:10 +05:30
parent e43cebb43e
commit 88f658fba9
378 changed files with 33242 additions and 115 deletions

View File

@@ -0,0 +1,22 @@
'use client';
import {useMemo} from 'react';
import {useWorkspace} from '@/shared/providers/WorkspaceProvider';
import type {Scope} from '@/shared/services/httpClient';
/**
* The {storeId, range} every scoped request is filtered by, in one hook.
*
* Feature hooks call this instead of taking scope as an argument, so a page
* never threads query parameters through its component tree — which is how the
* dashboard's six panels are guaranteed to agree about what period they are
* showing.
*
* Memoised on its two fields so the object identity only changes when the
* scope actually does. useResource keys off the serialized URL rather than
* this reference, but a stable object keeps it out of other dependency arrays.
*/
export function useScope(): Scope {
const {storeId, range} = useWorkspace();
return useMemo(() => ({storeId, range}), [storeId, range]);
}