[cache] Fixing cache key w/ merged extra filters #3809
Merged
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.
I was alerted to this issue when after force refreshing a dashboard and then exploring the slice, I observed that the slice wasn't cache and/or there were inconsistencies in the cached values.
It turns out that the reason is the cache key for a slice is different from these views, as the dashboard key contained the
extra_filters
which were absent from the slice view. The remedy was to simply update the cache key logic to mutate the form data which is being used as the cache key by calling themerge_extra_filters
method. Note I don't have full context over these extra filters or whether this call should be abstracted in some way.Also the
merge_extra_filters
method previously only handled the case when theextra_filters
field was non-empty, however this logic needed to be loosen to handle the case of the field being present to ensure that the field is removed.Note I'm uncertain whether an additional test case is required. I had something of the form,
however the
dash.url
leverages async functionality and thus I'm uncertain how best to wait for the page content to load.