sadpandajoe commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3826777906


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -161,19 +161,29 @@ const makeTab = (
   catalog: string | null = null,
   schema: string | null = null,
   closed: boolean = false,
+  backendId?: string,
 ): Tab => {
   const panels: Panel[] = []; // TODO: Populate panels
   const editorGetter = closed
     ? () => Promise.reject(new Error(`Tab ${id} has been closed`))
     : () => getEditorAsync(id);
-  return new Tab(id, name, dbId, catalog, schema, editorGetter, panels);
+  return new Tab(
+    id,
+    name,
+    dbId,
+    catalog,
+    schema,
+    editorGetter,
+    panels,
+    backendId,
+  );
 };
 
 const getTab = (id: string): Tab | undefined => {
   const queryEditor = findQueryEditor(id);
   if (queryEditor?.dbId !== undefined) {
-    const { name, dbId, catalog, schema } = queryEditor;
-    return makeTab(id, name, dbId, catalog, schema);
+    const { name, dbId, catalog, schema, tabViewId } = queryEditor;

Review Comment:
   Tabs hydrated from `tabstateview` use the persisted ID as `queryEditor.id` 
but do not have `tabViewId`, so this leaves the newly documented `backendId` 
undefined after a reload. Could this fall back to the persisted editor ID when 
it represents the backend tab?



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: 
React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>

Review Comment:
   A remote entry can fail while the extensions index still loads: 
`initializeExtension()` converts that failure to `false`, so 
`initializeExtensions()` resolves and this success handler runs instead of the 
toast path. Could the aggregate reject or otherwise surface a warning when any 
extension fails to initialize?



##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',
+    // Extensions register tab-type commands here. When any are present the
+    // "+" new-tab button becomes a dropdown listing all registered tab types
+    // plus the built-in SQL Editor option.
+    newTab: 'sqllab.newTab',
   },
 } as const;
+
+/**
+ * localStorage key an extension sets before calling createTab() to declare
+ * which northPane view the new tab should open with.  The value must be the
+ * view ID passed to views.registerView() (e.g. "my-ext.northPane").  SqlEditor
+ * consumes and removes this key during initialization, then persists the 
chosen
+ * view ID under a per-tab key so the mode survives page reloads.
+ *
+ * @example
+ * // In an extension's newTab command handler:
+ * localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'my-ext.northPane');
+ * sqlLab.createTab({ title: 'My View' });
+ */
+export const PENDING_NORTH_PANE_VIEW_KEY = 'sqllab.pendingNorthPaneView';

Review Comment:
   This is one origin-wide mailbox, so two extension `setItem`/`createTab` 
sequences can overwrite each other before the first editor mounts; the first 
tab then loses its requested pane. Could the requested view be carried in 
tab-creation state instead of shared localStorage?



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