Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages #6940

Merged
merged 1 commit into from
Nov 11, 2024
Merged

Version Packages #6940

merged 1 commit into from
Nov 11, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 6, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@builder.io/[email protected]

Minor Changes

  • Async functions in useComputed are deprecated. (by @wmertens in #7013)

    Why?

    • Qwik can't track used signals after the first await, which leads to subtle bugs.
    • When calculating the first time, it will see it's a promise and it will restart the render function.
    • Both useTask and useResource are available, without these problems.

    In v2, async functions won't work.

    Again, to get the same functionality use useTask or useResource instead, or this function:

    export const useAsyncComputed$ = (qrlFn: QRL<() => Promise<any>>) => {
      const sig = useSignal();
      useTask(({ track }) => {
        const result = track(qrlFn);
        if (result && 'then' in result) {
          result.then(
            (val) => (sig.value = val),
            (err) => {
              console.error('async computed function threw!', err);
              throw error;
            }
          );
        } else {
          sig.value = result;
        }
      });
      return sig;
    };
  • ✨ Expose unwrapStore as a low level AP (by @GrandSchtroumpf in #6960)

    This enables developers to clone the content of a useStore() using structureClone or IndexedDB

Patch Changes

  • 📃 fix useResource docs example & remove unused demo (by @ianlet in #6893)

  • 🐞🩹 QRL segment filenames are no longer lowercased. This was giving trouble with parent lookups in dev mode and there was no good reason for it. (by @wmertens in #7003)

  • 🐞🩹 the type for <textarea> now accepts text children, as per spec. (by @wmertens in #7016)

  • 🐞🩹 dev-mode QRL paths are now handled by Vite so they are the same as the parent paths. You can see this in the Sources section of the browser devtools, where the segments are now always next to their parents (when the parent is loaded). (by @wmertens in #7037)

  • 🐞🩹 vite is now a peer dependency of qwik, qwik-city, qwik-react and qwik-labs, so that there can be no duplicate imports. This should not have consequences, since all apps also directly depend on vite. (by @wmertens in #6945)

  • ✨ sync$ QRLs will now be serialized into the HTML in a shorter form (by @wmertens in #6944)

  • 🐞🩹 cli build command appearing to "hang" on errors (by @shairez in #6943)

  • ✨ Allow setting linkFetchPriority for modulepreload links in the prefetch strategy. Also fix the links in dev mode (by @GrandSchtroumpf in #6947)

[email protected]

Patch Changes

[email protected]

Patch Changes

  • 🐞🩹 the @typescript-eslint/utils dependency is upgraded and made explicit in the package (by @wmertens in #7030)

@builder.io/[email protected]

Patch Changes

  • 🐞🩹 MDX content no longer ignores Layout components. See the MDX docs for more information. (by @danielvaijk in #6845)

  • 🐞🩹 SSG errors now show the path that failed (by @wmertens in #6998)

  • 🐞🩹 Fixed action redirect regression where searchParams were appended (by @brandonpittman in #6927)

  • 🐞🩹 Redirect, error, and fail request events no longer forcefully delete user-defined Cache-Control HTTP header value. (by @nelsonprsousa in #6991)

  • 🐞🩹 vite is now a peer dependency of qwik, qwik-city, qwik-react and qwik-labs, so that there can be no duplicate imports. This should not have consequences, since all apps also directly depend on vite. (by @wmertens in #6945)

  • 🐞🩹 Fixed MDX layout default export being ignored by transformer. (by @danielvaijk in #6845)

  • 🐞🩹 Prevent unexpected caching for q-data.json (by @genki in #6808)

  • 🐞🩹 Multiple rewrite routes pointing to the same route is no longer an error. (by @JerryWu1234 in #6970)

@github-actions github-actions bot requested review from a team as code owners October 6, 2024 20:17
@github-actions github-actions bot force-pushed the changeset-release/main branch 15 times, most recently from e738993 to 5c20c80 Compare October 13, 2024 21:28
@github-actions github-actions bot force-pushed the changeset-release/main branch 8 times, most recently from f92a48c to 3e1e2e2 Compare October 19, 2024 17:16
@github-actions github-actions bot force-pushed the changeset-release/main branch 5 times, most recently from caf01fe to 631b1ad Compare October 28, 2024 22:18
@github-actions github-actions bot force-pushed the changeset-release/main branch 18 times, most recently from 7df81ee to 1576261 Compare November 4, 2024 15:25
@shairez shairez merged commit 9ecfa4c into main Nov 11, 2024
2 checks passed
@shairez shairez deleted the changeset-release/main branch November 11, 2024 15:34
@genki
Copy link
Contributor

genki commented Nov 21, 2024

I have slightly modified the useAsyncComputed$ to be worked without errors as follows

export const useAsyncComputedQrl = <T>(qrlFn: QRL<() => Promise<T>>) => {
  const sig = useSignal<T>();
  useTask$(({ track }) => {
    const result = track(qrlFn);
    if ('then' in result) {
      result.then(
        (val) => (sig.value = val),
        (err) => {
          console.error('async computed function threw!', err);
          throw err;
        }
      );
    } else {
      sig.value = result;
    }
  });
  return sig;
};
export const useAsyncComputed$ = implicit$FirstArg(useAsyncComputedQrl);

@wmertens
Copy link
Member

@genki cool! Maybe you can add a cookbook to the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants