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

Function useTaskQrl

packages/qwik/src/core/use/use-task.ts:280–299  ·  view source on GitHub ↗
(qrl: QRL<TaskFn>, opts?: UseTaskOptions)

Source from the content-addressed store, hash-verified

278 */
279// </docs>
280export const useTaskQrl = (qrl: QRL<TaskFn>, opts?: UseTaskOptions): void => {
281 const { val, set, iCtx, i, elCtx } = useSequentialScope<boolean>();
282 if (val) {
283 return;
284 }
285 assertQrl(qrl);
286
287 const containerState = iCtx.$renderCtx$.$static$.$containerState$;
288 const task = new Task(TaskFlagsIsDirty | TaskFlagsIsTask, i, elCtx.$element$, qrl, undefined);
289 set(true);
290 qrl.$resolveLazy$(containerState.$containerEl$);
291 if (!elCtx.$tasks$) {
292 elCtx.$tasks$ = [];
293 }
294 elCtx.$tasks$.push(task);
295 waitAndRun(iCtx, () => runTask(task, containerState, iCtx.$renderCtx$));
296 if (isServerPlatform()) {
297 useRunTask(task, opts?.eagerness);
298 }
299};
300
301/** @public */
302export const createComputedQrl = <T>(qrl: QRL<ComputedFn<T>>): Signal<Awaited<T>> => {

Callers 1

index.qwik.mjsFile · 0.90

Calls 7

useSequentialScopeFunction · 0.90
assertQrlFunction · 0.90
waitAndRunFunction · 0.90
isServerPlatformFunction · 0.90
setFunction · 0.85
runTaskFunction · 0.85
useRunTaskFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…