Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prefetch): add prefetch query hook generation #92

Merged
merged 1 commit into from Apr 28, 2024

Conversation

seriouslag
Copy link
Collaborator

@seriouslag seriouslag commented Apr 25, 2024

This PR adds prefetch query generation.

I haven't tested this in an actual app to know if it is prefetching the data
Any help here would be great.
The example is working, but I haven't used prefetch before.

closes: #91

The JSDocs are added to the function but do not make the most sense.
This is because they list return types when prefetch functions do not return anything.

@seriouslag seriouslag requested a review from 7nohe April 25, 2024 19:21
Copy link

github-actions bot commented Apr 25, 2024

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 99.08% (🎯 95%) 1732 / 1748
🟢 Statements 99.08% (🎯 95%) 1732 / 1748
🟢 Functions 100% (🎯 95%) 37 / 37
🟢 Branches 94.8% (🎯 85%) 146 / 154
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/constants.mts 100% 100% 100% 100%
src/createExports.mts 100% 100% 100% 100%
src/createPrefetch.mts 100% 100% 100% 100%
src/createSource.mts 100% 100% 100% 100%
src/createUseQuery.mts 100% 100% 100% 100%
Generated in workflow #237

@seriouslag seriouslag force-pushed the feature/add-prefetch-query-generation branch 2 times, most recently from 51fc0cf to e6c8645 Compare April 25, 2024 20:19
@seriouslag seriouslag added the enhancement New feature or request label Apr 25, 2024
@@ -167,5 +192,9 @@ export const createSource = async ({
name: "suspense.ts",
content: suspenseResult,
},
{
name: "prefetch.ts",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use OpenApiRqFiles from constants.mts for this part as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated.

@seriouslag seriouslag force-pushed the feature/add-prefetch-query-generation branch from e6c8645 to 6de9d38 Compare April 27, 2024 17:16
@seriouslag seriouslag requested a review from 7nohe April 27, 2024 17:16
@7nohe 7nohe merged commit c7f76ec into main Apr 28, 2024
4 checks passed
@7nohe 7nohe deleted the feature/add-prefetch-query-generation branch April 28, 2024 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helpers to prefetch data
2 participants