Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix: event unexpect emit
Browse files Browse the repository at this point in the history
  • Loading branch information
airslice committed Jul 8, 2022
1 parent 807ad48 commit ae9c5ed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/molecules/Visualizer/Plugin/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,14 @@ export function Provider({

useEmit<Pick<ReearthEventType, "cameramove" | "select">>(
{
select: selectedLayer ? [selectedLayer.id] : [undefined],
cameramove: camera ? [camera] : undefined,
select: useMemo<[layerId: string | undefined]>(
() => (selectedLayer ? [selectedLayer.id] : [undefined]),
[selectedLayer],
),
cameramove: useMemo<[camera: CameraPosition] | undefined>(
() => (camera ? [camera] : undefined),
[camera],
),
},
emit,
);
Expand Down

0 comments on commit ae9c5ed

Please sign in to comment.