A clear and concise description of what the bug is.
When I add a fetch() and a created() hook to a view, the fetch hook is called before the created.
In a regular Nuxt application, it looks like the created hook is called before the fetch hook.
What seems to be happening for me, is that the fetch hook is called and sets data on the component to the response from fetch. Then created is called and the data is reset to the initial value.
Screenshots
If applicable, add screenshots to help explain your problem.
This screenshot shows the order of hooks called within a normal Nuxt application. You can see the created hook is fired first, and the testData on the object is currently the initialised value of an empty array.
The fetch hook is then called, and it sets testData to be an array with a value.
Inspecting the vue instance after shows that testData is now set to be the array with a value.
This screenshot shows the same reproduction but inside nuxt-micro-frontend. Here you can see that the fetch hook is being called first, and that testData has not been initialised.
The created hook is then called after with the initialised value. Inspecting the Vue instance afterwards, you can see that testData is the initialised value. The hooks also seem to be getting called twice.
To Reproduce
Steps to reproduce the behavior:
Go to single-spa-demo > nuxt-subapp > views > home > index.vue
Maybe Nuxt core has changed. This module just copy the template from Nuxt client.js with specific version. And I think it should release a major version to sync Nuxt latest for Vue2?
Describe the bug
A clear and concise description of what the bug is.
When I add a
fetch()
and acreated()
hook to a view, thefetch
hook is called before thecreated
.In a regular Nuxt application, it looks like the
created
hook is called before thefetch
hook.What seems to be happening for me, is that the
fetch
hook is called and sets data on the component to the response from fetch. Then created is called and the data is reset to the initial value.Screenshots
If applicable, add screenshots to help explain your problem.
This screenshot shows the order of hooks called within a normal Nuxt application. You can see the
created
hook is fired first, and thetestData
on the object is currently the initialised value of an empty array.The
fetch
hook is then called, and it setstestData
to be an array with a value.Inspecting the vue instance after shows that
testData
is now set to be the array with a value.This screenshot shows the same reproduction but inside nuxt-micro-frontend. Here you can see that the
fetch
hook is being called first, and thattestData
has not been initialised.The
created
hook is then called after with the initialised value. Inspecting the Vue instance afterwards, you can see thattestData
is the initialised value. The hooks also seem to be getting called twice.To Reproduce
Steps to reproduce the behavior:
single-spa-demo
>nuxt-subapp
>views
>home
>index.vue
Expected behavior
A clear and concise description of what you expected to happen.
The created hook should be called first, before the fetch hook.
environment information