threepointone/glamor

TypeError: Invalid value used as weak map key

Closed this issue · 20 comments

Hey there Sunil,

After uprading to 2.20.13, I'm getting this error

TypeError: Invalid value used as weak map key on load of my site.

Any clue?

Damn I wish I had some sample css for you, its hard to parse given my Meteorjs errors. Let me look and ill get back to you.

Let me verify this brb!

None of my css calls are doing straight up strings. But my webpack devtools arent being too helpful at eval any ideas to help you out?

on it

I published 2.20.16 with a try/catch for the above error, and it logs the arguments to console at least once. Give it a spin and lemme know, if it fixes your issue, and what it spits out to console for this error.

Yo sunil, you were right, it was a css fuck up in another module we have

failed setting the WeakMap cache for args: data-css-wn814s: ""
this should NOT happen, please file a bug on the github repo.

Thanks so much for putting this log in here. I was wondering if we could do this for any error generated by Glamor? often times its my own doing, but it would be nice to know what blew up since my app is humungous

Damn, we have a bunch of these in our app. I wonder if the aphrodite shim people have these

foo ? css(bar) : ''

cause i believe null in aphrodite's css blows up

? null, undefined should work fine in css, was fixed in #42 and #44. just tried it out too.

that error message that got logged looks odd...

I'd be happy to help you debug for a few minutes if you've been able to reproduce this, and can use ngrok or something. Lemme know.

ok, I think I know what's going on, it's quite subtle. Gimme a day or so and I'll fix this.

your current workaround should be to avoid sending those strings.

Yeah what Im saying is null/undefined did not work in aphrodite unless im mistaken. So we had tons of code just returning empty strings. Thus causing this error when we did a sweeping change to use glamor/aphrodite.

Resolving the ternaries to null works out fine for us, just tons of those to go through. Let me know if you need anything else

I got in a fix for you, live in 2.20.19. lemme know if it works.

Thanks a lot Sunil. will check this out today! Appreciate the speed!

You'll appreciate the speed of the new release more :P The aphrodite shim goes very well with the new WeakMap caches, so your app should get faster for free. Lemme know!

closing this, lemme know if the issue persists. cheers.