kgabryje commented on code in PR #39908:
URL: https://github.com/apache/superset/pull/39908#discussion_r3201182927


##########
superset-frontend/src/explore/actions/hydrateExplore.ts:
##########
@@ -77,6 +77,10 @@ export const hydrateExplore =
     const fallbackSlice = sliceId ? sliceEntities?.slices?.[sliceId] : null;
     const initialSlice = slice ?? fallbackSlice;
     const initialFormData = form_data ?? initialSlice?.form_data;
+    const isCachedFormData = getUrlParam(URL_PARAMS.formDataKey) !== null;
+    const initialSliceName =
+      (isCachedFormData ? initialFormData : initialSlice)?.slice_name ??
+      (isCachedFormData ? initialSlice : initialFormData)?.slice_name;

Review Comment:
   this expression is kinda hard to read... perhaps it would be better with 
if/else?
   Or maybe even sth like:
   ```
   const [primary, fallback] = isCachedFormData
       ? [initialFormData, initialSlice]
       : [initialSlice, initialFormData];
     const initialSliceName = primary?.slice_name ??
     fallback?.slice_name;
   ```
   up to you though



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