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.

useFetch returns data.result === null on RC.6 in production mode.

See original GitHub issue

Environment

Nuxt CLI v3.0.0-rc.6
RootDir: /Users/.../Documents/development/professional/MY_PROJECT
Nuxt project info:

------------------------------
- Operating System: `Darwin`
- Node Version:     `v18.6.0`
- Nuxt Version:     `3.0.0-rc.5`
- Package Manager:  `npm@8.13.2`
- Builder:          `vite`
- User Config:      `modules`, `head`, `css`, `vite`, `srcDir`, `progress`
- Runtime Modules:  `nuxt-progress@0.1.4`
- Build Modules:    `-`
------------------------------

Reproduction

I’m sorry, but I can’t reproduce the bug except on my project. However, I know the bug is due to the v3.0.0-rc.6 because I tried an old commit, with the v3.0.0-rc.4 so it was working. And just with upgrading to the rc.6, the bug appears. Using the code below, outside of my project, it’s working. But it was working on rc.4, so I don’t understand 😕

Describe the bug

useFetch returns data.value null on client (at the first fetch), but it seems to have a value on server. When I fetch again (with a “load more” button) I get my results.

<script lang="ts" setup>
import { useFetch } from '#app';

async function fetchArticles (): Promise<void> {
  articles.isLoading = true;
  const { data } = await useFetch<{ posts: GhostPage[] } & BrowseResults>('GHOST CONTENT API', {
    params: {
      key: 'API',
      include: ['authors', 'tags'].join(','),
      page: articles.currentPage
    },
    pick: ['posts', 'meta']
  });
  if (data.value.meta.pagination.pages === articles.currentPage)
    articles.hasMore = false;
  articles.data.push(...data.value.posts);
  articles.filteredData = filterArticles(articles.data);
  articles.isLoading = false;
}
</script>

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danielroecommented, Aug 15, 2022

I’m closing as RC8 is now out. Let me know if it wasn’t resolved and I’ll reopen!

0reactions
wzy1935commented, Jul 30, 2022

@pi0 @danielroe Edge channel works for me, thanks! Looking forward to the final release👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

useFetch custom hooks is somehow returning data twice ...
You initialize data in useFetch hook as null . Then, when your TableComponent is first rendered, the useEffect inside useFetch fires, at which ......
Read more >
oci_fetch_array - Manual
oci_fetch_array(resource $statement , int $mode = OCI_BOTH | OCI_RETURN_NULLS): array|false. Returns an array containing the next result-set row of a query.
Read more >
PGA/UGA Memory - Ask TOM
PGA/UGA Memory Tom,I not using MTS but when I run the following query why do I get such a high value for UGA...
Read more >
Building custom hooks in React to fetch Data
Now we return the states that are created inside the hook as an object. Using Custom Hook in the Component. Inside the component,...
Read more >
pureXML Guide
DB2 10, most utility functions become available in new-function mode. ... Confirm that the resulting value is 0. 6. Query XML data.
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