nuxt-modules / nuxt-modules/strapi
Data is not the same when doing a page reload vs $router.push
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 717
- Forks
- 89
- Avg merge
- 7h 3m
- Merged PRs (30d)
- 6
Description
Version
@nuxtjs/strapi: ^0.3.1
nuxt: 2.15.3
Steps to reproduce
- I have a collection which has a
has and belongs to onewith $strapi.user namedendpoint - I am a calling following method to get some endpoint data while $strapi.user is logged in:
async asyncData({$strapi}) {
try {
if($strapi.user) {
let getendpoint = null
console.log($strapi.user.endpoint) // called with route, returns id, page reload returns endpoint object
getendpoint = await $strapi.find('endpoints', {'id': $strapi.user.endpoint}) // works with page reload, but not with route.push
getendpoint = await $strapi.find('endpoints', {'id': $strapi.user.endpoint.id}) // works with $route but not page reload
if(getendpoint) {
...
When routed to the page via this.$nuxt.$router.push('/route') from login I get a different $strapi.user.endpoint object compared to a page refresh $strapi.user.endpoint.
a.) The $router.push redirect returns an int id of the endpoint
b.) The page reload returns an endpoint object and to make the call I need to call $strapi.user.endpoint.id to get the getendpoint
What is Expected?
It should return the same data object on route and page reload
What is actually happening?
It returns different data objects doing the same call to $strapi.user.endpoint with different loading methods ... why?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in asyncData with $strapi.user.endpoint, comparing navigation through $router.push with a full page reload. Check both endpoint and endpoint.id against the reported $strapi.find calls; done means the behavior is explained and the endpoint data is consistent or the discrepancy is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxtjs, typescript
- Domain
- api, authentication, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100