-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
refactor: refetch on change #1205
Conversation
WalkthroughThe changes involve modifications to various hooks, socket connection logic, configuration constants, and cache management in the application. Key alterations include updates to the data refetching intervals in hooks, enhancements to socket message handling for data synchronization, and improvements in cache metadata tracking. Additionally, comments were added to clarify configuration values. These changes aim to optimize performance and ensure more effective data management. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant Cache
Client->>Server: Request data
Server-->>Client: Send data
Client->>Cache: Store data
Client->>Server: Listen for updates
Server->>Client: ontime-refetch message with revision
Client->>Cache: Check current revision
alt New revision
Client->>Cache: Invalidate queries
Client->>Server: Fetch latest data
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- apps/client/src/common/hooks-query/useCustomFields.ts (2 hunks)
- apps/client/src/common/hooks-query/useRundown.ts (2 hunks)
- apps/client/src/common/utils/socket.ts (2 hunks)
- apps/client/src/ontimeConfig.ts (1 hunks)
- apps/server/src/services/rundown-service/RundownService.ts (1 hunks)
- apps/server/src/services/rundown-service/rundownCache.ts (2 hunks)
Files skipped from review due to trivial changes (1)
- apps/client/src/ontimeConfig.ts
Additional comments not posted (10)
apps/client/src/common/hooks-query/useCustomFields.ts (2)
4-4
: LGTM!The code changes are approved.
17-17
: LGTM! But verify the impact of the change on the application's performance and user experience.The code changes are approved. However, please ensure that the slower refetch interval does not negatively impact the application's performance or user experience.
Run the following script to verify the impact of the change:
apps/client/src/common/hooks-query/useRundown.ts (2)
5-5
: LGTM!The code changes are approved.
19-19
: LGTM! But verify the impact of the change on the application's performance and data consistency.The code changes are approved. However, please ensure that the slower refetch interval does not negatively impact the application's performance or data consistency.
Run the following script to verify the impact of the change:
apps/client/src/common/utils/socket.ts (3)
1-1
: LGTM!The code changes are approved.
3-3
: LGTM!The code changes are approved.
179-189
: LGTM!The code changes are approved. The new case for handling the 'ontime-refetch' message is implemented correctly and enhances the functionality of the socket connection by allowing it to respond dynamically to updates in the server's rundown data.
apps/server/src/services/rundown-service/RundownService.ts (1)
250-253
: LGTM!The code changes are approved. The
payload
object is correctly constructed with thechanges
andrevision
properties, enhancing the information sent tosendRefetch
.apps/server/src/services/rundown-service/rundownCache.ts (2)
218-218
: LGTM!The code changes are approved. The
revision
property is correctly added to the metadata object returned by thegetMetadata
function, enhancing the metadata structure to include versioning information.
247-251
: LGTM!The code changes are approved. The early return mechanism is correctly introduced in the
mutateCache
function, optimizing the function by preventing unnecessary operations when no mutation occurs. Therevision
variable is correctly incremented only when there is a meaningful change to the cache.
this implements refetching in the client when we get a refetch message
It also adds a revision field to the refetch payload so the client can decide whether the refetch is essential