-
Notifications
You must be signed in to change notification settings - Fork 87
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
async assigning a value to metatags doesn't work #279
Comments
I also hit this issue, fairly large use case with metadata coming from a CMS (for example). |
Is this still an issue @jakobrosenberg |
AFAIK yes. |
Please give a warning to metatags section. for 2 days I tried to find the cause of this error. First time, I thought this error came from Vite. it turns out that the error comes from the I can make a PR to give the warning if you want. Let me know. |
I am confused what the linked comment is involved? Am I missing something? @lamualfa |
In First time when I get this Error, I think the problem came from Vite. Because of that, I try to find the solution about that error and I found the same problem It also happened in the svelte kit. One of the svelte kit contributor said that the error was caused by Vite. Then the error has been fixed in the latest PR made by the svelte kit contributor to the vite repository. It's been 2 days since the PR was made the changes haven't been merged. Impatient, I tried to comment on the PR page (That's the link I gave above). 2 days later PR was merged and the latest version of vite was out. I rushed to get the version tested right away on my routify project. After updating, it turns out that the error still occurs. I was really confused to find out what caused the error. In the end, I tried to dig deeper into the issues that exist in routify repository. And then Voila! I encountered this issue with the exact same case as mine. I use |
This has hopefully been fixed in For async metatags, use |
@jakobrosenberg Is I have tried to use it in
<script>
import { onMount } from 'svelte';
import { metatags } from '@roxi/routify';
onMount(() => {
new Promise((resolve) => setTimeout(resolve, 3000)).then(() => {
$metatags.title = 'Hello world';
});
});
</script>
<h1>Hello world</h1> Error |
@lamualfa https://www.npmjs.com/package/@roxi/routify/v/2.16.0 The store API has only been added in |
@jakobrosenberg Oh ok. it looks like the NPM cache has just been updated. I am sorry 😅. |
@jakobrosenberg Voila! now it's work in |
Closing this for now then. 🙂 |
Bug Description
Assigning a value to
metatags
inside of a function (e.g. a request callback) throwsError: Function called outside component initialization
.Routify Version
2.1.3 (latest)
Example
The text was updated successfully, but these errors were encountered: