question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fix: Double requests being made on client-side

See original GitHub issue

🐛 The bug

After some testing of the module it looks like that it’s actually doing two requests per page on the client-side. One for the static json file and one for the actual API.

I’ve tried the example from the docs with adding a process.server check to my useAsyncData but that just returns false.

🛠️ To reproduce

https://stackblitz.com/github/danielroe/nuxt-full-static/tree/main/playground

🌈 Expected behaviour

When click on the individual posts I would expect it to only make a request for the static json file but it also makes a request to the API 🙂

Screenshot 2022-09-04 at 19 17 42

ℹ️ Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
simoneldevigcommented, Sep 8, 2022

@danielroe hmm - me neither.

Unfortunately I’m not able to create a proper reproduction of what happens in my own project, since it’s currently running with a local api.

I suspect that it might be caused by a timing issue with the Object.assign and big amounts of data in the client plugin, which might cause the route to resolved before the data is added to the payload cache.

I’ll try to do some testing with wrapping it in a promise and manually resolving once data has been mapped and make a PR if I find a solution 😄

0reactions
TechAkayycommented, Sep 12, 2022

Also, in the above repo, from the posts.vue page, clicking on the various post titles, it opens the same post.

If post with id:10 is clicked first, then going back to all posts and clicking a different title, opens post id:10 again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Avoid Duplicate API Requests? - Daffodil Software
Here is what leads to duplicate API request issues and how to overcome the problem.
Read more >
Apollo Client sends duplicate requests · Issue #7722 - GitHub
For every GraphQL query, I see logs for two requests. I know these are being sent by Apollo Client because I added a...
Read more >
Avoid duplicate POSTs with REST - Stack Overflow
Another solution that's been proposed for this is POST Once Exactly (POE), in which the server generates single-use POST URIs that, ...
Read more >
Handling multiple ad requests with UserContext
Since ad requests are made asynchronously, ensuring the proper ad manager is associated with the correct context can seem to be a daunting ......
Read more >
Advanced Usage — Requests 2.28.1 documentation
It also persists cookies across all requests made from the Session instance, ... You can also specify a local cert to use as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found