From 39a256a5579c60bff4a31825acadf37d778ebf62 Mon Sep 17 00:00:00 2001 From: Varixo Date: Mon, 12 Aug 2024 21:55:11 +0200 Subject: [PATCH] fix use-resource tests --- packages/qwik/src/core/use/use-resource.ts | 5 +++-- packages/qwik/src/core/use/use-task.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/qwik/src/core/use/use-resource.ts b/packages/qwik/src/core/use/use-resource.ts index 0226290f75f..6cecfdacdb3 100644 --- a/packages/qwik/src/core/use/use-resource.ts +++ b/packages/qwik/src/core/use/use-resource.ts @@ -262,8 +262,9 @@ function getResourceValueAsPromise(props: ResourceProps): Promise | Promise | Signal; if (isResourceReturn(resource)) { const isBrowser = !isServerPlatform(); + // create a subscription for the resource._state changes + const state = resource._state; if (isBrowser) { - const state = resource._state; DEBUG && debugLog(`RESOURCE_CMP.${state}`, 'VALUE: ' + untrack(() => resource._resolved)); if (state === 'pending' && props.onPending) { @@ -272,7 +273,7 @@ function getResourceValueAsPromise(props: ResourceProps): Promise resource._resolved) as T).then(props.onResolved); } } return resource.value.then( diff --git a/packages/qwik/src/core/use/use-task.ts b/packages/qwik/src/core/use/use-task.ts index 7df4622e549..375d507e3e6 100644 --- a/packages/qwik/src/core/use/use-task.ts +++ b/packages/qwik/src/core/use/use-task.ts @@ -588,7 +588,7 @@ export const runResource = ( if (prop) { return (obj as Record)[prop]; } else if (isSignal2(obj)) { - return obj.untrackedValue; + return obj.value; } else { return obj; }