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

fix(core): assign refs without reactivity during SSR #5802

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

wmertens
Copy link
Member

@wmertens wmertens commented Jan 30, 2024

During SSR, reactivity on refs will cause dirty tasks, and besides, refs are used to interact with the DOM, which is not possible with the MockElements.

Example script that has dirty tasks without this fix:

import { component$, useTask$, useSignal, useVisibleTask$ } from '@builder.io/qwik';

export default component$(() => {
  const ref = useSignal<Element>()

  useTask$(({track}) => {
    console.log(`task runs, ref is ${track(ref) ? '':'un'}defined`)
  })
  useVisibleTask$(({track}) => {
    console.log(`visibleTask runs, ref is ${track(ref) ? '':'un'}defined`)
  })

  return <p ref={ref}>Hello Qwik</p>;
});

playground

Relevant error report on Discord

hylobatidae: I'm getting an error with something internal in Qwik and want to debug it. The error that I get is on 1.4.2 is:

[vite] Internal server error: a2.$el$.compareDocumentPosition is not a function
  File: /Projects/frontend/dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:2922:2

Copy link

netlify bot commented Jan 30, 2024

👷 Deploy request for qwik-insights pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a503848

@wmertens wmertens merged commit 408576e into QwikDev:main Jan 31, 2024
25 checks passed
@wmertens wmertens deleted the ssr-refs-inactive branch January 31, 2024 00:06
kodiakhq bot pushed a commit to ascorbic/unpic-img that referenced this pull request Feb 11, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@builder.io/qwik](https://qwik.builder.io/) ([source](https://togithub.com/BuilderIO/qwik/tree/HEAD/packages/qwik)) | [`1.4.3` -> `1.4.4`](https://renovatebot.com/diffs/npm/@builder.io%2fqwik/1.4.3/1.4.4) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@builder.io%2fqwik/1.4.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@builder.io%2fqwik/1.4.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@builder.io%2fqwik/1.4.3/1.4.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@builder.io%2fqwik/1.4.3/1.4.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>BuilderIO/qwik (@&#8203;builder.io/qwik)</summary>

### [`v1.4.4`](https://togithub.com/BuilderIO/qwik/releases/tag/v1.4.4)

[Compare Source](https://togithub.com/BuilderIO/qwik/compare/v1.4.3...v1.4.4)

#### What's Changed

-   feat(vite): make linting op-out by [@&#8203;wmertens](https://togithub.com/wmertens) in [QwikDev/qwik#5801
-   fix(core): assign refs without reactivity during SSR by [@&#8203;wmertens](https://togithub.com/wmertens) in [QwikDev/qwik#5802
-   fix(docs): correct minor typos by [@&#8203;kylerush](https://togithub.com/kylerush) in [QwikDev/qwik#5804
-   chore(starters): update 🐼 PandaCSS integration starter dev dependency by [@&#8203;mrhoodz](https://togithub.com/mrhoodz) in [QwikDev/qwik#5806
-   fix(scoped styles): [@&#8203;container](https://togithub.com/container) block by [@&#8203;wmertens](https://togithub.com/wmertens) in [QwikDev/qwik#5813
-   chore: ci e2e: single worker and longer timeout by [@&#8203;wmertens](https://togithub.com/wmertens) in [QwikDev/qwik#5814
-   fix(link): Prefetch redirects to error pages. Fixes [#&#8203;5474](https://togithub.com/BuilderIO/qwik/issues/5474) by [@&#8203;iamriajul](https://togithub.com/iamriajul) in [QwikDev/qwik#5817
-   chore: publish qwik-react with types by [@&#8203;wmertens](https://togithub.com/wmertens) in [QwikDev/qwik#5819
-   fix: Fix input reactivity in `useResource$()` tutorial by [@&#8203;alexcsandru](https://togithub.com/alexcsandru) in [QwikDev/qwik#5818
-   docs: fix qwik-nutshell example by [@&#8203;ozanmakes](https://togithub.com/ozanmakes) in [QwikDev/qwik#5824
-   chore(starters): update 🐼 PandaCSS integration starter dev dependency by [@&#8203;mrhoodz](https://togithub.com/mrhoodz) in [QwikDev/qwik#5825
-   chore: 1.4.4 by [@&#8203;wmertens](https://togithub.com/wmertens) in [QwikDev/qwik#5828

#### New Contributors

-   [@&#8203;kylerush](https://togithub.com/kylerush) made their first contribution in [QwikDev/qwik#5804
-   [@&#8203;alexcsandru](https://togithub.com/alexcsandru) made their first contribution in [QwikDev/qwik#5818
-   [@&#8203;ozanmakes](https://togithub.com/ozanmakes) made their first contribution in [QwikDev/qwik#5824

**Full Changelog**: QwikDev/qwik@v1.4.3...v1.4.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9pm on sunday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ascorbic/unpic-img).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
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.

None yet

1 participant