Skip to content

Commit

Permalink
fix(web): revert published page VR layer selection (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx committed Jun 20, 2023
1 parent a797dd2 commit 02d7fa5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
24 changes: 1 addition & 23 deletions web/src/classic/components/organisms/Published/core/hooks.ts
@@ -1,5 +1,5 @@
import { mapValues } from "lodash-es";
import { useState, useMemo, useEffect, useCallback } from "react";
import { useState, useMemo, useEffect } from "react";

import type { Block, ClusterProperty } from "@reearth/classic/components/molecules/Visualizer";
import {
Expand All @@ -15,10 +15,7 @@ import {
type LegacyLayer,
convertLegacyCluster,
} from "@reearth/classic/core/mantle";
import type { ComputedLayer } from "@reearth/classic/core/mantle/types";
import type { LayerSelectionReason } from "@reearth/classic/core/Map/Layers/hooks";
import { config } from "@reearth/services/config";
import { useSelected } from "@reearth/services/state";

import type {
PublishedData,
Expand All @@ -34,7 +31,6 @@ export default (alias?: string) => {
const [data, setData] = useState<PublishedData>();
const [ready, setReady] = useState(false);
const [error, setError] = useState(false);
const [selected, select] = useSelected();

const sceneProperty = processProperty(data?.property);
const pluginProperty = Object.keys(data?.plugins ?? {}).reduce<{ [key: string]: any }>(
Expand All @@ -58,22 +54,6 @@ export default (alias?: string) => {

const tags = data?.tags; // Currently no need to convert tags

const selectedLayerId = useMemo(() => {
return selected?.type === "layer"
? { layerId: selected.layerId, featureId: selected.featureId }
: undefined;
}, [selected]);

const selectLayer = useCallback(
(
id?: string,
featureId?: string,
_layer?: () => Promise<ComputedLayer | undefined>,
layerSelectionReason?: LayerSelectionReason,
) => select(id ? { layerId: id, featureId, layerSelectionReason, type: "layer" } : undefined),
[select],
);

const widgets = useMemo<
| {
floatingWidgets: InternalWidget[];
Expand Down Expand Up @@ -237,8 +217,6 @@ export default (alias?: string) => {
ready,
error,
engineMeta,
selectedLayerId,
selectLayer,
};
};

Expand Down
4 changes: 0 additions & 4 deletions web/src/classic/components/organisms/Published/core/index.tsx
Expand Up @@ -19,8 +19,6 @@ export default function Published({ alias }: Props) {
error,
clusters,
engineMeta,
selectedLayerId,
selectLayer,
} = useHooks(alias);

return error ? (
Expand All @@ -32,8 +30,6 @@ export default function Published({ alias }: Props) {
floatingWidgets={widgets?.floatingWidgets}
widgetAlignSystem={widgets?.alignSystem}
ownBuiltinWidgets={widgets?.ownBuiltinWidgets}
selectedLayerId={selectedLayerId}
onLayerSelect={selectLayer}
tags={tags}
sceneProperty={sceneProperty}
pluginProperty={pluginProperty}
Expand Down

0 comments on commit 02d7fa5

Please sign in to comment.