Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
upcoming: [DI-19328] - Added capability to save & retrieve CloudPulse user preferences #10625
upcoming: [DI-19328] - Added capability to save & retrieve CloudPulse user preferences #10625
Changes from all commits
f8ee586
3b04a09
8a266d1
6b0dd47
6f6584c
afc40fc
44f0ebe
22693dd
20d8e78
10d5366
5d03d05
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this file
utils.ts
to remain consistent with convention in the codebase.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the case of file name to camel case because in future more util files will be added for different functionalities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to use our React Query data layer for anything related to user preferences. (
packages/manager/src/queries/profile/preferences.ts
). We try to use that instead of interfacing with@linode/api-v4
functions directlyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add to Banks, here's reference point in our docs: https://linode.github.io/manager/development-guide/05-fetching-data.html#react-query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!! for the suggestion. We will take this up as part of enhancements later to use React Query Data layer via https://track.akamai.com/jira/browse/DI-19503 as in Q3 we have a commitment for beta with minimum functionalities. Hope this is fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kmuddapo Use of React Query is something we'd need to see in this PR to get it merged, rather than later. Using direct api-v4 functions is rare in our codebase, and it may be acceptable on a one-off basis, but our best practice is to use RQ almost all the time -- this offers caching benefits, helps us manage states (loading, errors), as well as provides overall consistency in code. (See here for our section of documentation on this.) In this PR, even with debouncing, we'd be making several requests to
/profile/preferences
and we should be leveraging the RQ cache.@nikhagra Please update to use React Query here in place of the api-v4 functions, and let us know if you run into any questions on implementing that switch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have: JSDocs comments are useful to include for custom hooks and utils. useRestrictedGlobalGrantCheck and usePagination are a couple examples of where we do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure