useFetch returns data.result === null on RC.6 in production mode.
See original GitHub issueEnvironment
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:
- Created a year ago
- Comments:7 (4 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
I’m closing as RC8 is now out. Let me know if it wasn’t resolved and I’ll reopen!
@pi0 @danielroe Edge channel works for me, thanks! Looking forward to the final release👍