-
Couldn't load subscription status.
- Fork 11
fix(web): edge case where archived notifications don't appear #978
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
Conversation
if the archive has already been fetched/loaded.
WalkthroughThe changes in this pull request focus on enhancing cache management for notifications within the Apollo Client setup in the Changes
Possibly related PRs
Suggested reviewers
🪧 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: 1
🧹 Outside diff range and nitpick comments (1)
web/helpers/apollo-cache/index.ts (1)
150-151: Consider compatibility of 'structuredClone' for deep cloning
structuredCloneis a relatively new API and may not be supported in all environments. Consider using an alternative method for deep cloning to ensure broader compatibility.Alternative approach using a utility library:
import cloneDeep from 'lodash/cloneDeep'; // ... const updated = cloneDeep(data);Or using JSON methods (if the data is serializable):
const updated = JSON.parse(JSON.stringify(data));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
web/helpers/apollo-cache/index.ts(4 hunks)
🔇 Additional comments (3)
web/helpers/apollo-cache/index.ts (3)
1-7: Imports are appropriately updated for enhanced cache management
The added imports and type alias improve clarity and support the new cache functionality for handling notifications.
145-145: Verify that 'NotificationType.Archive' is correctly referenced
Ensure that NotificationType.Archive is properly imported and corresponds to the correct value used for filtering archived notifications.
172-172: Consistent use of 'NotificationCacheType' in cache operations
Great job updating the __typename to NotificationCacheType when identifying the cache entry. This ensures accurate eviction of the notification from the cache.
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
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.
Just this nit pick
0a2c07c to
41bbc9b
Compare
…y modifying cache
41bbc9b to
4adf354
Compare
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: 1
🧹 Outside diff range and nitpick comments (1)
web/helpers/apollo-cache/index.ts (1)
137-137: Remove @ts-expect-error by properly typing the query variablesInstead of suppressing the TypeScript error, consider creating proper types for the query variables.
- // @ts-expect-error the cache only uses the filter type; the limit & offset are superfluous. - variables: { filter: { type: NotificationType.Archive } }, + variables: { + filter: { type: NotificationType.Archive }, + limit: 1, // Add minimum required fields + offset: 0 + },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
web/helpers/apollo-cache/index.ts(4 hunks)
🔇 Additional comments (4)
web/helpers/apollo-cache/index.ts (4)
2-4: LGTM: Import changes are appropriate
The new imports support the archive notification functionality and improve type consistency.
64-66: LGTM: Clear and helpful documentation
The added documentation effectively explains the cache busting behavior and its impact on the user experience.
133-153: Verify the impact of cache eviction on UI stability
While the implementation addresses the archived notifications visibility issue, there are a few concerns to consider:
- The complete cache eviction when the archive list is empty (line 142) might cause unnecessary refetches of unrelated notification data.
- As noted in the comments, this may cause temporary jitter with infinite scroll.
Consider implementing a more targeted cache update strategy to minimize UI disruption.
168-169: LGTM: Improved type consistency
The change to use NotificationCacheType aligns with the correct type for cache operations.
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
if the archive has already been fetched/loaded.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation