-
Notifications
You must be signed in to change notification settings - Fork 583
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(APW): Refresh content review - pull data on every 10s #3506
Conversation
@mihajlovco
Yes, I know this is an edge case, but its quite possible (internet gets slow, system is overwhelmed with requests, etc...). I would recommend using setTimeout and when callback is done, start a new timeout. |
You can either look for an npm package which does this kind of stuff (I don't know of any, so can't recommend). while(true) {
// Issue api call...
// Wait for 5 seconds before doing another loop.
await new Promise(resolve => setTimeout(resolve, 5000));
} Make sure you test this, and make it "abortable", so the process stops if you unmount a component (if such a scenario is needed). |
Thanks for the fast feedback, I will change that as you suggested. |
…instead of the custom one
How will this code: prevent the issue I wrote about in my first comment? |
With this PR we introducing a near-realtime experience for APW UI. Content will be refreshing every 10s.
What kind of updates user can see on the UI:
Content review list page
: Refresh of the list of content reviewsContent review details page
: Refresh the comments, change requests, and content review state (stapes and signoff).Changes
Comments list
Test videos:
Use case 1
andUse case 2
Change request list
Use case 3
andUse case 4
Content review list and details
Use case 5
Technical changes
useFetchInterval
hook. This hook uses a recursive function that will not execute until the API call is finished + the delay.- Fetch interval test screenshot:
Use case 6
Exposed
refetch
method fromuseQuery
that allows the user to fetch the content in the following hooks:useCommentsList
hookuseChangeRequestsList
hookuseContentReview
useContentReviewList
Components where a 10s refresh interval is implemented.
Comments
component - updates commentsCenterPanel
component - updates the change requests and content review step statesContentReviewDataList
component - updates the list of content reviewsHow Has This Been Tested?
Manually. Check the videos in the testing section.
Testing
Use case 1: Users can see the updates of the new messages
The user waiting for the new comment to appear on the same change request
apw-messeges-between-users.mov
Use case 2: Comments time interval is destroyed when the comment section is no longer visible.
apw-destroed-time-interval-instance.mov
Use case 3: Change request list updates every 10s.
apw-requests-sync.mov
Use case 4: Change request status update.
apw-request-change-status-update.mov
Use case 5: Content review list and single content review updates.
apw-content-review-list-and-details.mov
Use case 6: Fetch interval tests.