From 17fd085ee364ba1be12ea135bd4507a9e638bb59 Mon Sep 17 00:00:00 2001 From: etowahadams Date: Wed, 12 Jun 2024 14:26:30 -0400 Subject: [PATCH] feat(core): Make reactive default in component (#1073) * feat: default reactive * fix: make component in editor use default --- editor/Editor.tsx | 1 - src/core/gosling-component.tsx | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/editor/Editor.tsx b/editor/Editor.tsx index 8ce1de99..c681760e 100644 --- a/editor/Editor.tsx +++ b/editor/Editor.tsx @@ -1220,7 +1220,6 @@ function Editor(props: RouteComponentProps) { border={'none'} id={'goslig-component-root'} className={'goslig-component'} - experimental={{ reactive: true }} compiled={(_, h) => { setHg(h); }} diff --git a/src/core/gosling-component.tsx b/src/core/gosling-component.tsx index f2c0f972..eaeb44bc 100644 --- a/src/core/gosling-component.tsx +++ b/src/core/gosling-component.tsx @@ -40,9 +40,7 @@ export interface GoslingCompProps { theme?: Theme; templates?: TemplateTrackDef[]; urlToFetchOptions?: UrlToFetchOptions; - experimental?: { - reactive?: boolean; - }; + reactive?: boolean; } export type GoslingRef = { @@ -51,6 +49,7 @@ export type GoslingRef = { }; export const GoslingComponent = forwardRef((props, ref) => { + const { reactive = true } = props; const [viewConfig, setViewConfig] = useState(); // Keeping track of whether the initial render has occured is important so the API works pr const [isInitialRender, setIsInitialRender] = useState(true); @@ -129,7 +128,7 @@ export const GoslingComponent = forwardRef((props, // Update the compiled view config const isMountedOnce = typeof viewConfig !== 'undefined'; - if (props.experimental?.reactive && isMountedOnce) { + if (reactive && isMountedOnce) { // Use API to update visualization. setTimeout(() => { preverseZoomStatus(