oekazuma / svelte-meta-tags

Svelte Meta Tags provides components designed to help you manage SEO for Svelte projects.
MIT License
510 stars 22 forks source link

Title is no longer reactive after 3.1.1 #1010

Closed WarningImHack3r closed 5 months ago

WarningImHack3r commented 5 months ago

Describe the bug A clear and concise description of what the bug is.

After upgrading to 3.1.1 (#977), the <title> tag is no longer reactive if set from a reactive Svelte value

Reproduction Provide a reproduction URL or steps to reproduce. If a report is vague and no reproduction is provided within a reasonable time-frame, the issue will be closed.

  1. Create let title = "myTitle"
  2. Use <MetaTags {title} />
  3. Reactively change its value by binding it to some button or something
  4. Notice the title doesn't update from a reactive update

(You can easily reproduce it by visiting https://svelte-changelog.vercel.app and switching the Svelte/SvelteKit/Other tab, if you downgrade your dependency locally the title changes on tab switch)

Additional context Add any other context about the problem here.

oekazuma commented 5 months ago

I don't know if this is a Svelte bug or a spec, but it seems that if you enclose variables in {#if} within <svelte:head>, reactivity is lost. As a tentative measure, I will try to solve this problem by enclosing variables with {#key}. Svelte5 seems to have resolved this issue, so it will be resolved in the future.

WarningImHack3r commented 5 months ago

Thanks for your help and your reactivity!

oekazuma commented 5 months ago

A corrected version has been released!

https://github.com/oekazuma/svelte-meta-tags/releases/tag/svelte-meta-tags%403.1.2

WarningImHack3r commented 5 months ago

Thank you!! Keep up the good work :)