-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix(entities-*): persist fetcher cache key within session #1820
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aaa69e1
fix(entities-*): persist fetcher cache key within session
Justineo 6e17605
fix(entities-shared): provide default row-key
Justineo 34981fe
fix(entities-*): do not fallback to table pref key if cache id is not…
Justineo 0fb305f
fix(entities-*): use param from watch callback
Justineo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
issue: I'm not sure the fallback here makes sense. I understand it will work; however, there's no documentation or expectation that the table's cache identifier will fallback to the table preferences storage key.
If anyone upstream was utilizing one or the other to save data in localStorage or the session, etc., this would be unexpected and could cause conflicting values to override each other in the upstream implementation.
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 believe the cacheId isn't used for local storage, it's used for as SWRV cache key so there shouldn't be any clashes unless the preferences storage key was used as a swrv cache key somewhere.
Either way, we can mitigate this risk by adding some static string like:
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.
It's not currently that we know of, but it could be
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 added this because in
<EntityBaseTable>
, we have the following logic:public-ui-components/packages/entities/entities-shared/src/components/entity-base-table/EntityBaseTable.vue
Lines 260 to 263 in c550fc8
I thought we should apply similar logic to ensure a consistent fetcher cache key. However, if this isn't necessary, I believe we can simply remove the fallback.
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.
To add further context: In
<EntityBaseTable>
, theprops.cacheIdentifier || props.preferencesStorageKey
is already used as both thecacheIdentifier
for<KTableData>
and the key for table preferences inlocalStorage
. Even if users do not provide acacheIdentifier
for the entity lists, the fetcher results are stored using fallback keys derived frompreferencesStorageKey
. Therefore, the intention here is to generate keys for persistentfetcherCacheKey
containers here using the same logic.Before this change: Even when
cacheIdentifier
is not provided, caching still occurs, and its behavior is essentially consistent with when it is provided.After: If
cacheIdentifier
is not passed, thefetcherCacheKey
cannot be persisted, leading to inconsistent behavior compared to when it is provided. That said, this inconsistency only reflects the behavior prior to optimization, so the impact may not be significant. And indeed, I also think the current approach reveals a bit of abstraction leakage for<EntityBaseTable>
. So I think I'd just remove the fallback.@adamdehaven @kaiarrowood