-
Notifications
You must be signed in to change notification settings - Fork 6
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
Configurable prop for UI kit components to refetch data #93
Configurable prop for UI kit components to refetch data #93
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
PRO-2152 Configurable prop for UI Kit components to refetch data
We have a customer, Christian, who says
Can we have a prop for defining a refresh interval? Ideally, we will take into consideration what other libraries do. For example, Apollo Client has a react-query has react-query's |
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 need to use the functionality that GraphQL code generator is already providing us. It will simplify things. Please look at my PR here, and let's build on that: #97
It still needs the React app changes merged in. Can you please help add those to the PR, and help to test/validate?
const [refetchInterval, setRefetchInterval] = React.useState(undefined) | ||
|
||
const handleSwitchRefetchInterval = () => { | ||
setRefetchInterval(refetchInterval ? undefined : 1000) |
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.
Should this just be refetchInterval ?? 1000
, and in all subsequent places, too?
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.
Something else I am thinking about: there is a lot of manual work keeping the React examples in sync between 16, 17, and 18. If we diff the files, are they really so different? If not, I think we should consider
- Checking in one, canonical version of the CounterConnectedTest.jsx, LeaderboardConnectedText.jsx, etc. (by the way, I just notice that these should be tsx, so we can test the types 🤔).
- At build time, copying the canonical version of the CounterConnectedTest.jsx, LeaderboardConnectedText.jsx, etc., into the React 16, 17, and 18 folders (if there are minor patches we need to apply, we can do that).
But this may make maintenance easier.
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.
I think right now there is no difference between the code of each version, I like this idea of having a canonical version of each.
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.
Should this just be refetchInterval ?? 1000, and in all subsequent places, too?
That wouldn't work, here we just want to switch from undefined => 1000 and from 1000 => undefined
refetchInterval ?? 1000
would set refetchInterval
to 1000 when it's undefined but wouldn't set it to undefined when it's 1000
Closed in favor of #97 |
Description of changes
This PR implements React Query for all the UI Kit components and adds a prop for allowing the user to set a refetch interval
Checklist
Before merging to main:
Release notes