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

Reactivity broken when store values used in both style attributes & style: directives #9185

Closed
ivan-lednev opened this issue Sep 6, 2023 · 0 comments · Fixed by #9187
Closed

Comments

@ivan-lednev
Copy link

Describe the bug

Take a look at the sandbox:
https://svelte.dev/repl/3806195fc2924034a9175a8d38dedc87?version=4.2.0

  1. Read two values from a store, one in a style attribute, another in a style: directive
  2. Update the value read in style:

Expected:

  • Value gets updated

Actual:

  • Correct value gets logged and displayed in other places
  • But it doesn't get updated inside style:

Reproduction

https://svelte.dev/repl/3806195fc2924034a9175a8d38dedc87?version=4.2.0

Logs

No response

System Info

The issue is reproducible in a sandbox by the link above. I don't think this is relevant.

Severity

annoyance

ivan-lednev referenced this issue in ivan-lednev/obsidian-day-planner Sep 7, 2023
There are issues in svelte with cascading dependencies
in reactive declarations, from what I understand.
Since `background color` relies on `$store.timelineColored`,
having `textColor` rely on both seemed to cause issues.
Removing the direct dependency of the store works,
anyway.
dummdidumm pushed a commit that referenced this issue Sep 20, 2023
… style directive is updated via an object prop. fixes #9185 (#9187)

fixes #9185.

I narrowed down the issue to the bug surfacing when we use object properties to update style attributes and directives. This fix removes the size check (because a single object will be of size 1 but can affect n attributes/directives via its properties).

In addition, the order of the OR is switched as the earlier condition has some reactive assignments which are not run in the current order when style_changed_var is truthy.
kelvinsjk added a commit to kelvinsjk/svelte that referenced this issue Oct 19, 2023
… style directive is updated via an object prop. fixes sveltejs#9185 (sveltejs#9187)

fixes sveltejs#9185.

I narrowed down the issue to the bug surfacing when we use object properties to update style attributes and directives. This fix removes the size check (because a single object will be of size 1 but can affect n attributes/directives via its properties).

In addition, the order of the OR is switched as the earlier condition has some reactive assignments which are not run in the current order when style_changed_var is truthy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant