Skip to content

Commit

Permalink
chore(web): missing visualizerRef on published page (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
airslice authored Jun 5, 2024
1 parent 5604978 commit 37030ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion web/src/beta/features/PublishedVisualizer/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useMemo, useEffect } from "react";
import { useState, useMemo, useEffect, useRef } from "react";

import {
InternalWidget,
Expand All @@ -8,6 +8,7 @@ import {
isBuiltinWidget,
} from "@reearth/beta/features/Visualizer/Crust";
import { Story } from "@reearth/beta/features/Visualizer/StoryPanel";
import { MapRef } from "@reearth/core";
import { config } from "@reearth/services/config";

import { processProperty } from "./convert";
Expand All @@ -22,6 +23,7 @@ import type {
} from "./types";

export default (alias?: string) => {
const visualizerRef = useRef<MapRef | null>(null);
const [data, setData] = useState<PublishedData>();
const [ready, setReady] = useState(false);
const [error, setError] = useState(false);
Expand Down Expand Up @@ -248,6 +250,7 @@ export default (alias?: string) => {
ready,
error,
engineMeta,
visualizerRef,
};
};

Expand Down
14 changes: 12 additions & 2 deletions web/src/beta/features/PublishedVisualizer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ export type Props = {

export default function Published({ alias }: Props) {
const t = useT();
const { sceneProperty, pluginProperty, layers, widgets, story, ready, error, engineMeta } =
useHooks(alias);
const {
sceneProperty,
pluginProperty,
layers,
widgets,
story,
ready,
error,
engineMeta,
visualizerRef,
} = useHooks(alias);

return error ? (
<NotFound
Expand All @@ -20,6 +29,7 @@ export default function Published({ alias }: Props) {
/>
) : (
<Visualizer
visualizerRef={visualizerRef}
engine="cesium"
engineMeta={engineMeta}
isBuilt
Expand Down

0 comments on commit 37030ff

Please sign in to comment.