Skip to content

Commit

Permalink
chore(web): show installed widgets & fix computed feature property (#727
Browse files Browse the repository at this point in the history
)

Co-authored-by: keiya01 <keiya.s.0210@gmail.com>
  • Loading branch information
airslice and keiya01 committed Oct 8, 2023
1 parent 124d3c1 commit 5e9eddf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web/src/beta/lib/core/Map/Layers/hooks.ts
Expand Up @@ -365,7 +365,8 @@ export default function useHooks({
rawLayer.type === "simple" &&
rawLayer.data?.value &&
// If data isn't cachable, reuse layer id for performance.
DATA_CACHE_KEYS.some(k => !rawLayer.data?.[k])
DATA_CACHE_KEYS.some(k => !rawLayer.data?.[k]) &&
Object.isExtensible(rawLayer.data.value)
) {
// If layer property is overridden, feature is legacy layer.
// So we can set layer id to prevent unnecessary render.
Expand Down
9 changes: 8 additions & 1 deletion web/src/beta/lib/core/engines/Cesium/useEngineRef.ts
Expand Up @@ -533,7 +533,14 @@ export default function useEngineRef(
tag.computedFeature ?? {
type: "computedFeature",
id: tag.featureId,
properties: entity.properties,
properties:
entity.properties &&
Object.fromEntries(
entity.properties.propertyNames.map(key => [
key,
entity.properties?.getValue(viewer.clock.currentTime)?.[key],
]),
),
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/api/widgetsApi/utils.ts
Expand Up @@ -41,7 +41,7 @@ export const getInstallableWidgets = (rawScene?: GetSceneQuery) => {
.filter(
e =>
e.type === PluginExtensionType.Widget &&
AVAILABLE_WIDGET_IDS.includes(`reearth/${e.extensionId}`),
(AVAILABLE_WIDGET_IDS.includes(`reearth/${e.extensionId}`) || plugin.id !== "reearth"),
)
.map((e): InstallableWidget => {
return {
Expand Down

0 comments on commit 5e9eddf

Please sign in to comment.