-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: revamp catalog sdk and its react-query (#1578)
Because @thewbuk Please take a look at this PR, since this is the clean up task for your implementation, I would like to point out several crucial points that might be helpful for your future implementation - You need to keep your writing consistent and clean, there have many unnecessary syntax, such as - `return Promise.resolve()` -> The async/await already wrap the un-returned function for you - You didn't cast `use client` in your react-query, they are hook so can only work on the client side - You need to follow what BE provided, there are dozens of endpoint didn't provide pagination but you still expose pageSize and pageToken on them such as listNamespaceCatalogs - It's pretty clear that you didn't understand the API you are working with well enough Besides all the above code smell issues, I revamped some structure and make it stay consistent with our other query-hook - Centralized queryKeyStore for better key cache management - Separate paginated endpoint and non-paginated endpoint in the sdk - Retain the response structure in the sdk response, so user need to pour them out like how we did it in the react-query, `res.chunk` This commit - revamp catalog sdk and its react-query
- Loading branch information
Showing
35 changed files
with
1,015 additions
and
766 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 9 additions & 11 deletions
20
packages/toolkit/src/lib/react-query-service/catalog/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
export * from "./useCreateCatalog"; | ||
export * from "./useDeleteCatalog"; | ||
export * from "./useUpdateCatalog"; | ||
export * from "./useGetCatalogs"; | ||
export * from "./useUploadCatalogFile"; | ||
export * from "./useCreateNamespaceCatalog"; | ||
export * from "./useDeleteNamespaceCatalog"; | ||
export * from "./useUpdateNamespaceCatalog"; | ||
export * from "./useListNamespaceCatalogs"; | ||
export * from "./useCreateNamespaceCatalogFile"; | ||
export * from "./useProcessCatalogFiles"; | ||
export * from "./useListCatalogFiles"; | ||
export * from "./useListNamespaceCatalogFiles"; | ||
export * from "./useDeleteCatalogFile"; | ||
export * from "./useGetFileDetails"; | ||
export * from "./useGetCatalogSingleSourceOfTruthFile"; | ||
export * from "./useListChunks"; | ||
export * from "./useUpdateChunk"; | ||
export * from "./useGetAllChunks"; | ||
export * from "./useGetNamespaceCatalogSingleSourceOfTruthFile"; | ||
export * from "./useUpdateCatalogChunk"; | ||
export * from "./useListNamespaceCatalogChunks"; |
43 changes: 0 additions & 43 deletions
43
packages/toolkit/src/lib/react-query-service/catalog/useCreateCatalog.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.