qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[📖] Docs/tutorials expect extra renders - signals are too efficient!

Open cmbartschat opened this issue 2 years ago • 1 comments

Suggestion

If a component inserts store values directly into the JSX for example, Qwik can propagate signal updates directly into the DOM without re-running the component's render function. This seems to have made a number of tutorials/docs out of date.

Discussed a bit on discord: https://discord.com/channels/842438759945601056/1060999298671718540/1060999298671718540

These are the sorts of inaccuracies noticed (please feel free to add more)

  • [ ] https://qwik.builder.io/docs/concepts/reactivity/#counter-example "downloads the rendering function and re-runs the OnRender method"
  • [ ] https://qwik.builder.io/tutorial/reactivity/template/ "a++ button will only cause the re-rendering of <DisplayA>"
  • [ ] https://qwik.builder.io/tutorial/projection/basic/ "Notice that the <App> is re-render on button click"
  • [ ] https://qwik.builder.io/tutorial/props/store/ "The re-rendering of <App> is needed to update the props of <Display>"

Additionally, is there anything we can to to assist the mental model when describing this behavior - is there a word for the "rerender without rerender"?

If there is appetite here to make some changes I can read through all the docs/tutorials and make sure we have the exhaustive list.

cmbartschat avatar Jan 08 '23 18:01 cmbartschat

I think it'd be a good idea

RaghavBhat02 avatar Jan 11 '23 06:01 RaghavBhat02

@cmbartschat Thanks for your report. Would you like fix the docs for this particular topic?

gioboa avatar Aug 26 '23 20:08 gioboa

Happy to! I just need a little bit of direction from a terminology standpoint. Is there a word the core team uses to describe the "rerender without rerender"?

How would these two processes be labelled?

  1. A component's render function gets run again in response to a signal change
  2. The DOM structure receives targeted updates in response to a signal change, without invoking component code

cmbartschat avatar Aug 28 '23 17:08 cmbartschat

Thanks, this would make a significant community issue. Is anyone up for a PR?

mhevery avatar Aug 28 '23 17:08 mhevery

@mhevery I'm working on it ✏️

wtlin1228 avatar Sep 03 '23 05:09 wtlin1228

Thanks @wtlin1228 💪

gioboa avatar Sep 03 '23 07:09 gioboa

Closing this issue as PRs have landed...

mhevery avatar Sep 05 '23 20:09 mhevery