mikebridge commented on code in PR #45055:
URL: https://github.com/apache/superset/pull/45055#discussion_r4214934843
##########
superset-frontend/src/utils/semanticViewStructure.ts:
##########
@@ -94,28 +91,19 @@ export const fetchSemanticViewStructure = async (
semanticViewId: number | string,
): Promise<SemanticViewStructure> => {
const endpoint = `/api/v1/semantic_view/${semanticViewId}/structure`;
- try {
- const response = await cachedSupersetGet({ endpoint });
- const {
- name,
- dimensions = [],
- metrics = [],
- semantic_selection_version,
- } = response.json?.result ?? {};
- return {
- name,
- dimensions,
- metrics,
- semantic_selection_version: semantic_selection_version ?? undefined,
- };
- } catch (error) {
- // cacheWrapper caches the promise itself and never evicts on rejection, so
- // a single failed response would poison this endpoint for the rest of the
- // page session. Evict on error so a later call refetches — mirroring the
- // regular-dataset drill branch (hooks/apiResources/datasets.ts).
- supersetGetCache.delete(endpoint);
- throw error;
- }
+ const response = await cachedSupersetGet({ endpoint });
Review Comment:
Good catch that a successful structure response can go stale. The merge-base
already used `cachedSupersetGet` at `semanticViewStructure.ts:98` and retained
successful entries in `cacheWrapper.ts:28-33`; this PR keeps that behavior at
:94 and only adds eviction for failed requests. Schema-change invalidation or a
cache lifetime for successful responses is a separate follow-up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]