MCPcopy Create free account
hub / github.com/bytebase/bytebase / addTab

Function addTab

frontend/src/react/stores/sqlEditor/tab.ts:194–220  ·  view source on GitHub ↗
(payload, beside = false)

Source from the content-addressed store, hash-verified

192 },
193
194 addTab(payload, beside = false) {
195 const defaultTab: SQLEditorTab = {
196 ...defaultSQLEditorTab(),
197 ...omitBy(payload, isUndefined),
198 };
199 const { id } = defaultTab;
200
201 set((s) => {
202 let tab = s.tabsById.get(id);
203 if (tab) {
204 Object.assign(tab, omitBy(payload, isUndefined));
205 } else {
206 tab = defaultTab;
207 s.tabsById.set(id, tab);
208 }
209
210 upsertOpenTabDraft(s, tab, beside);
211 s.currentTabId = id;
212 });
213
214 persistOpenTabs(get().openTmpTabList);
215 persistCurrentTabId(id);
216
217 // Return the live (post-immer) tab reference so callers reading
218 // fields immediately see the seeded values.
219 return get().tabsById.get(id) ?? defaultTab;
220 },
221
222 cloneTab(targetId, payload) {
223 const targetTab = get().tabsById.get(targetId);

Callers

nothing calls this directly

Calls 8

defaultSQLEditorTabFunction · 0.90
setFunction · 0.85
upsertOpenTabDraftFunction · 0.85
persistOpenTabsFunction · 0.85
getFunction · 0.85
persistCurrentTabIdFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected