v-if causing "Unhandled error during execution of scheduler flush" after form.post
See original GitHub issueVersions:
@inertiajs/inertiaversion: 0.8.7@inertiajs/inertia-vue3version: 0.3.14vueversion 3.0.11
Describe the problem:
When posting a form that updates a prop that is being used in a v-if something goes wrong.
Getting a warning with:
[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug.
Followed by an error:
TypeError: can’t access property “insertBefore”, parent is null
Steps to reproduce:
I’m using Laravel and Vue3. Here’s a component (Route/Index):
<template>
<!-- here I have a layout component -->
<form @submit.prevent="form.post(route('route.post'))">
<button>Create thing</button>
</form>
<div v-if="someProp">
{{ someProp }}
</div>
<!-- end of layout component -->
</template>
<script>
import { useForm } from '@inertiajs/inertia-vue3'
export default {
props: {
someProp: String
}
setup () {
const form = useForm()
return { form }
},
}
</script>
Here’s the laravel controller methods:
public function index()
{
return Inertia::render('Route/Index', [
'someProp' => session()->get('propContent'),
]);
}
public function store()
{
// do stuff
$prop = 'Blabla';
return redirect()->back()->with('propContent', $prop);
}
Workaround
As a workaround I’m adding { preserveState: false } to form.post and it works.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:22 (3 by maintainers)
Top Results From Across the Web
Unhandled error during execution of scheduler flush. This is ...
The error was caused by trying to iterate through a non-iterable (in your case undefined ), using v-for . Specifically, before the call...
Read more >Vue 3 Error During Execution Of Native Event - ADocLib
Unhandled error during execution of scheduler flush. This is likely a Vue internals bug vue3 whenever the user submits the form and vue....
Read more >Unhandled error during execution of scheduler flush. This is ...
The error was caused by trying to iterate through a non-iterable (in your case undefined ), using v-for . Specifically, before the call...
Read more >[vue warn]: failed to resolve component: router-link - You.com
I believe the issue relay on the vue/vue-router versions. ... Vue error makes no sense: Unhandled error during execution of scheduler flush.
Read more >Bug listing with status RESOLVED with resolution TEST ...
Error in sched.c line 961." status:RESOLVED resolution:TEST-REQUEST severity:major · Bug:22815 - "Gentoo fails to reboot after changes are made to the ...
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
Hey folks, this issue sounds similar to this one: #615
As noted in my comment on that issue, I was able to fix the issue by wrapping by entire page component in an extra
<div>. I have a feeling this issue is related to fragments in Vue 3.Give that a try and let me know?
@reinink I had this exact issue on a new install of Laravel / Jetstream / Inertia.