Skip to content

Commit

Permalink
feat(core): Make reactive default in component (#1073)
Browse files Browse the repository at this point in the history
* feat: default reactive

* fix: make component in editor use default
  • Loading branch information
etowahadams authored Jun 12, 2024
1 parent 12da1ba commit 17fd085
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,6 @@ function Editor(props: RouteComponentProps) {
border={'none'}
id={'goslig-component-root'}
className={'goslig-component'}
experimental={{ reactive: true }}
compiled={(_, h) => {
setHg(h);
}}
Expand Down
7 changes: 3 additions & 4 deletions src/core/gosling-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export interface GoslingCompProps {
theme?: Theme;
templates?: TemplateTrackDef[];
urlToFetchOptions?: UrlToFetchOptions;
experimental?: {
reactive?: boolean;
};
reactive?: boolean;
}

export type GoslingRef = {
Expand All @@ -51,6 +49,7 @@ export type GoslingRef = {
};

export const GoslingComponent = forwardRef<GoslingRef, GoslingCompProps>((props, ref) => {
const { reactive = true } = props;
const [viewConfig, setViewConfig] = useState<gosling.HiGlassSpec>();
// Keeping track of whether the initial render has occured is important so the API works pr
const [isInitialRender, setIsInitialRender] = useState(true);
Expand Down Expand Up @@ -129,7 +128,7 @@ export const GoslingComponent = forwardRef<GoslingRef, GoslingCompProps>((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(
Expand Down

0 comments on commit 17fd085

Please sign in to comment.