Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Make reactive default in component #1073

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading