You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/05/11 19:41:01 UTC

[GitHub] [superset] suddjian commented on a diff in pull request #20019: fix(embedded): third party cookies

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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org