mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
perf(sqllab): Rendering perf improvement using immutable state (#20877)
* perf(sqllab): Rendering perf improvement using immutable state - keep queryEditors immutable during active state - add unsavedQueryEditor to store all active changes - refactor each component to subscribe the related unsaved editor state only * revert ISaveableDatasource type cast * missing trigger prop * a default of an empty object and optional operator
This commit is contained in:
@@ -178,18 +178,38 @@ export const table = {
|
||||
export const defaultQueryEditor = {
|
||||
id: 'dfsadfs',
|
||||
autorun: false,
|
||||
dbId: null,
|
||||
dbId: undefined,
|
||||
latestQueryId: null,
|
||||
selectedText: null,
|
||||
selectedText: undefined,
|
||||
sql: 'SELECT *\nFROM\nWHERE',
|
||||
name: 'Untitled Query 1',
|
||||
schema: 'main',
|
||||
remoteId: null,
|
||||
tableOptions: [],
|
||||
functionNames: [],
|
||||
hideLeftBar: false,
|
||||
schemaOptions: [
|
||||
{
|
||||
value: 'main',
|
||||
label: 'main',
|
||||
name: 'main',
|
||||
title: 'main',
|
||||
},
|
||||
],
|
||||
templateParams: '{}',
|
||||
};
|
||||
|
||||
export const extraQueryEditor1 = {
|
||||
...defaultQueryEditor,
|
||||
id: 'diekd23',
|
||||
sql: 'SELECT *\nFROM\nWHERE\nLIMIT',
|
||||
name: 'Untitled Query 2',
|
||||
};
|
||||
|
||||
export const extraQueryEditor2 = {
|
||||
...defaultQueryEditor,
|
||||
id: 'owkdi998',
|
||||
sql: 'SELECT *\nFROM\nWHERE\nGROUP BY',
|
||||
name: 'Untitled Query 3',
|
||||
};
|
||||
|
||||
export const queries = [
|
||||
@@ -640,13 +660,14 @@ export const initialState = {
|
||||
alerts: [],
|
||||
queries: {},
|
||||
databases: {},
|
||||
queryEditors: [defaultQueryEditor],
|
||||
queryEditors: [defaultQueryEditor, extraQueryEditor1, extraQueryEditor2],
|
||||
tabHistory: [defaultQueryEditor.id],
|
||||
tables: [],
|
||||
workspaceQueries: [],
|
||||
queriesLastUpdate: 0,
|
||||
activeSouthPaneTab: 'Results',
|
||||
user: { user },
|
||||
unsavedQueryEditor: {},
|
||||
},
|
||||
messageToasts: [],
|
||||
common: {
|
||||
|
||||
Reference in New Issue
Block a user