From c72d68eb4a7992f6b4c596773f00df273dabdb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dcaro=20Guerra?= Date: Thu, 17 Oct 2024 16:51:39 -0300 Subject: [PATCH] fix(context-data): avoid unnecessary sets on observable map GitOrigin-RevId: 01095695d80c6dcd1d6171a6a7d428c87ce618bf --- platform/wab/src/wab/client/studio-ctx/view-ctx.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/wab/src/wab/client/studio-ctx/view-ctx.ts b/platform/wab/src/wab/client/studio-ctx/view-ctx.ts index 0c03a956685..4ecab74dfca 100644 --- a/platform/wab/src/wab/client/studio-ctx/view-ctx.ts +++ b/platform/wab/src/wab/client/studio-ctx/view-ctx.ts @@ -117,7 +117,7 @@ import { } from "@plasmicapp/react-web"; import asynclib from "async"; import $ from "jquery"; -import L, { defer, groupBy, head } from "lodash"; +import L, { defer, groupBy, head, isEqual } from "lodash"; import * as mobx from "mobx"; import { comparer, computed, observable } from "mobx"; import { computedFn } from "mobx-utils"; @@ -314,6 +314,10 @@ export class ViewCtx extends WithDbCtx { createSetContextDataFn = computedFn((valKey: string) => { return (value: any) => { + const oldValue = this._codeComponentValKeyToContextData.get(valKey); + if (isEqual(oldValue, value)) { + return; + } globalHookCtx.frameValKeyToContextData.set( mkFrameValKeyToContextDataKey(this.arenaFrame().uid, valKey), value