From 2c3dd4b79c24e7987b0c4e1614dbff4d9d7f49d1 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Thu, 16 Jan 2025 21:19:36 +0000 Subject: [PATCH] Fixes for various small issues caught by sentry --- shared/studio/tabs/dataview/state/index.ts | 7 +++++-- shared/studio/tabs/queryEditor/state/index.ts | 1 - shared/studio/tabs/schema/renderers/module.tsx | 5 ++++- shared/studio/tabs/schema/state/textView.ts | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/shared/studio/tabs/dataview/state/index.ts b/shared/studio/tabs/dataview/state/index.ts index 76ccfab2..78737349 100644 --- a/shared/studio/tabs/dataview/state/index.ts +++ b/shared/studio/tabs/dataview/state/index.ts @@ -948,10 +948,13 @@ export class DataInspector extends Model({ return; } - const dbState = dbCtx.get(this)!; - this.runningDataFetch?.abortController.abort(); + const dbState = dbCtx.get(this); + if (!dbState) { + return; + } + this.runningDataFetch = {abortController: new AbortController(), offset}; dbState.setLoadingTab(DataView, true); diff --git a/shared/studio/tabs/queryEditor/state/index.ts b/shared/studio/tabs/queryEditor/state/index.ts index 5340d5a9..6d975d84 100644 --- a/shared/studio/tabs/queryEditor/state/index.ts +++ b/shared/studio/tabs/queryEditor/state/index.ts @@ -819,7 +819,6 @@ export class QueryEditor extends Model({ }); return {success: true, capabilities, status}; } catch (e: any) { - console.error(e); this.addHistoryCell({ queryData, timestamp, diff --git a/shared/studio/tabs/schema/renderers/module.tsx b/shared/studio/tabs/schema/renderers/module.tsx index be5c7ee0..d098719f 100644 --- a/shared/studio/tabs/schema/renderers/module.tsx +++ b/shared/studio/tabs/schema/renderers/module.tsx @@ -26,7 +26,10 @@ export function ModuleRenderer({ if (isSticky) { const observer = new IntersectionObserver( ([e]) => { - if (e.boundingClientRect.top < e.rootBounds!.height / 2) { + if ( + e.rootBounds && + e.boundingClientRect.top < e.rootBounds.height / 2 + ) { setIsStuck(e.intersectionRatio < 1); } }, diff --git a/shared/studio/tabs/schema/state/textView.ts b/shared/studio/tabs/schema/state/textView.ts index 81405383..90352d84 100644 --- a/shared/studio/tabs/schema/state/textView.ts +++ b/shared/studio/tabs/schema/state/textView.ts @@ -144,8 +144,8 @@ export class SchemaTextView extends Model({ } getRenderHeight(index: number) { - const item = this.renderListItems.itemsList[index].item; - return item.schemaType === "Module" + const item = this.renderListItems.itemsList[index]?.item; + return !item || item.schemaType === "Module" ? 42 : this.renderHeights.get(item.id) ?? 42; }