Skip to content

Demo codes doesn't match with "When not to use effects" documentation code examples #13912

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

Closed
rintheo opened this issue Oct 25, 2024 · 0 comments · Fixed by #13911
Closed

Demo codes doesn't match with "When not to use effects" documentation code examples #13912

rintheo opened this issue Oct 25, 2024 · 0 comments · Fixed by #13911

Comments

@rintheo
Copy link

rintheo commented Oct 25, 2024

Describe the bug

The demo codes linked at the below paragraphs in the When not to use effects doesn't match the code examples written below them:

You might be tempted to do something convoluted with effects to link one value to another. The following example shows two inputs for "money spent" and "money left" that are connected to each other. If you update one, the other should update accordingly. Don't use effects for this (demo):

  • Label text for left at the demo code references left.value instead of just left as seen at the code example in the docs. This also causes the rendered slider for left to only display "/100 left" with no value.

Instead, use callbacks where possible (demo):

  • Same as above.

If you need to use bindings, for whatever reason (for example when you want some kind of "writable $derived"), consider using getters and setters to synchronise state (demo):

  • The demo code linked here doesn't match its corresponding code example entirely but does match the above paragraph's "Instead, use callbacks..." code example.

Reproduction

The 3 demo links at When not to use effects documentation.

Logs

No response

System Info

Not relevant

Severity

annoyance

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

Successfully merging a pull request may close this issue.

2 participants