suddjian commented on code in PR #20019:
URL: https://github.com/apache/superset/pull/20019#discussion_r870684089


##########
superset-frontend/packages/superset-ui-core/src/connection/callApi/callApi.ts:
##########
@@ -96,25 +96,34 @@ export default async function callApi({
     CACHE_AVAILABLE &&
     (window.location && window.location.protocol) === 'https:'
   ) {
-    const supersetCache = await caches.open(CACHE_KEY);
-    const cachedResponse = await supersetCache.match(url);
-    if (cachedResponse) {
-      // if we have a cached response, send its ETag in the
-      // `If-None-Match` header in a conditional request
-      const etag = cachedResponse.headers.get('Etag') as string;
-      request.headers = { ...request.headers, 'If-None-Match': etag };
+    let supersetCache: Cache | null = null;
+    try {
+      supersetCache = await caches.open(CACHE_KEY);
+      const cachedResponse = await supersetCache.match(url);
+      if (cachedResponse) {
+        // if we have a cached response, send its ETag in the
+        // `If-None-Match` header in a conditional request
+        const etag = cachedResponse.headers.get('Etag') as string;
+        request.headers = { ...request.headers, 'If-None-Match': etag };
+      }
+    } catch {
+      // todo: caches.open handle error

Review Comment:
   Is there actually any handling to do here? Empty catch kind of is the 
handler. Let's put an explanation instead.
   
   ```suggestion
         // If superset is in an iframe and third-party cookies are disabled, 
caches.open throws
   ```



-- 
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]

Reply via email to