Since Friday getting "Invalid value used in weak set" error in Plasmic generated code

Hi. From last Friday I am having this error in code generated by Plasmic:

Uncaught TypeError: Invalid value used in weak set
at WeakSet.add (<anonymous>)
at ref (vanilla.js?0d39:211:1)
at mkUntrackedValue (react-web.esm.js?80bc:1739:1)
at saveStateInitialValue (react-web.esm.js?80bc:2002:1)
at initializeStateValue (react-web.esm.js?80bc:1982:1)
at eval (react-web.esm.js?80bc:2036:1)
at Object.get (react-web.esm.js?80bc:1850:1)
at hasVariant (react-web.esm.js?80bc:428:1)
at PlasmicRecommendedSku__RenderFunc (PlasmicRecommendedSku.tsx?5f9b:97:1)
at func (PlasmicRecommendedSku.tsx?5f9b:167:1)

it looks like an error with React.useMemo hook when using variants. Can someone help me to avoid this problem?

Line of code that is failing:
{
RecommendedSku__textcomplex__o3HiNoK2Lo: hasVariant($state, 'complex', 'complex'),
},

useMemo hook:
const stateSpecs = React.useMemo(
() => [
{
path: 'complex',
type: 'private',
initFunc: ($props, $state) => $props['complex'],
},
],
[$props],
);

1 Like

I have a similar issue

I’m not using useMemo

And the component in question wasn’t updated in months.
I think a recent “plasmic sync” might have caused this.

Fixed it:

I found out, that this issue has already been fixed
https://github.com/plasmicapp/plasmic/commit/4fbbd01e5b59dac17845c8ec5833a5daef08fba4
So I updated @plasmicapp/react-web from 0.2.122 to 0.2.126