MCPcopy
hub / github.com/QwikDev/qwik / useSequentialScope

Function useSequentialScope

packages/qwik/src/core/use/use-sequential-scope.ts:21–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 * The storage provider for hooks. Each invocation increases index i. Data is stored in an array.
20 */
21export const useSequentialScope = <T>(): SequentialScope<T> => {
22 const iCtx = useInvokeContext();
23 const hostElement = iCtx.$hostElement$;
24 const elCtx = getContext(hostElement, iCtx.$renderCtx$.$static$.$containerState$);
25 const seq = (elCtx.$seq$ ||= []);
26 const i = iCtx.$i$++;
27
28 const set = (value: T) => {
29 if (qDev && qSerialize) {
30 verifySerializable(value);
31 }
32 return (seq[i] = value);
33 };
34
35 return {
36 val: seq[i],
37 set,
38 i,
39 iCtx,
40 elCtx,
41 };
42};

Callers 9

useStoreFunction · 0.90
useContextProviderFunction · 0.90
useContextFunction · 0.90
_useStylesFunction · 0.90
useTaskQrlFunction · 0.90
useVisibleTaskQrlFunction · 0.90
useIdFunction · 0.90
useConstantFunction · 0.90
useResourceQrlFunction · 0.90

Calls 2

useInvokeContextFunction · 0.90
getContextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…