Bug - Uncaught (in promise) TypeError: fn is not a function
See original GitHub issueImportant
This error only occurs in Routify v2.16.0
. I’ve tried Routify v2.14.0
, but the error doesn’t happen.
Bug Description
I get this error when click the back button of the browser. In other case, i got this error also when navigate to another page that contain metatags
helper.
How to get this error?
- Clone the Routify Starter template using
npx degit roxiness/routify-starter routify-starter
- Goto the project directory:
cd routify-starter
- Prepare module:
pnpm i
- Run:
pnpm dev
- Create new file with name
test.svelte
insrc/pages
- Put some code to that file. For me, i put this code:
<script>
import { onMount } from 'svelte';
import { metatags } from '@roxi/routify';
onMount(() => {
new Promise((resolve) => setTimeout(resolve, 3000)).then(() => {
$metatags.title = 'Hello world';
$metatags.description = 'Lorem ipsum dolor suila vot';
});
});
</script>
<h1>Hello world</h1>
- Add a link with the destination to
test.svelte
page:
Example
src/pages/example/_components/RoutifyIntro.svelte
<h1>Routify Starter</h1>
To see an example app, go to
<a href="/example">/example</a>
<a href="/test">/Test</a> // Add this
<p>To delete the example app, simply delete the ./src/pages/example folder.</p>
- and then open your browser, and goto http://localhost:5000/.
- Open your Browser Console (or Dev Tools).
- Click Test link that was created before.
- Click back button of your browser.
- You will get this error in your browser console.
Environment
- Routify
v2.16.0
- Svelte
v3.29.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
How to solve "TypeError: fn is not a function"? - Stack Overflow
I'm trying to implement Passport.JS and JWT functionality into my nodejs application and receive the following error.
Read more >Uncaught TypeError: fn is not a function when modify shared ...
In this case I'm getting "fn is not a function" error when trying to load "host2" app. Only when I add additional script...
Read more >Type error: fn is not a function. I don't know how to fix that.. Any ...
I've been trying to code a Discord bot to do a Timed mute, but there seems to be an error which I don't...
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lamualfa From what I can tell
$metatags
will work fine in prod, it’s being weird withsvelte-hmr
so you can just manually reload effected pages till we find out exactly what causes the hmr issue and fix it. But you shouldn’t have any issues in productionBasically
svelte-hmr
just hot module reloads page data when changes are made, so you will see this error whenever you save a file in development mode, but to fix you can just reload the page manuallyFirst of all, I am sorry. It seems that the description I gave is unclear. Therefore I try to summarize.
Below
v2.16.0
(this issue was not shown for this version)The problem only occurs in
metatags
that use the store. Meanwhile in this version Routify doesn’t supportmetatags
as store. So it can be concluded that the issue I created this time was not shown for this version.v2.16.0
and aboveIn this version Routify has been used
metatags
as a store. If you use this version and then usemetatags
as a store, you will get this error:For more detail about on how to get this error i have explained above.