WebReflection/uhtml

Uncaught TypeError: Cannot assign to read only property 'for'...

Closed this issue · 8 comments

Just came out of nowere. I'm getting the following error (Edge Version 104.0.1293.70):

Uncaught TypeError: Cannot assign to read only property 'for' of function '(template, ...values) => new Hole(type, template, values)'
    at Function.assign (<anonymous>)
    at tag (index.js:16:17)
    at index.js:60:14

No need to mention this was working fine in previous versions of Edge/Chromium. Maybe they made read-only something that you are trying to override?

Oh gosh … did they freeze arrows for no reason whatsoever or there’s a new for method sealed in function prototype? 🤦

Error is here... sure you know better, but just in case...

return Object.assign(
      (template, ...values) => new Hole(type, template, values),
      {
        for(ref, id) { <-- this one seems to be the problem
          const memo = keyed.get(ref) || keyed.set(ref, new MapSet);
          return memo.get(id) || memo.set(id, fixed(createCache()));
        },
        node: (template, ...values) => unroll(createCache(), new Hole(type, template, values)).valueOf()
      }
    );

My bad, found the issue... It's uhtml conflicting with bind.for. Seems that someone else added that to the project. Not sure if there is something you can do about this, but I'm closing the issue as is not really an issue.
Thank you for your time anyways.

By the way.. 2.8 works with bind.for, so maybe you can "fix" this after all... ;)

@CheloXL what's bind.for ? I can't fix obtrusive 3rd party libraries ... it's them that need fixes anyway. Fixed in bind.for 0.2.0

holy shit ... it was like "who wrote that shit?" ... and then "oh ... I did!"

@CheloXL please update bind.for to 0.2.0 which is fully tested as non-breaking for this, or any other, use case.

Apologies for the inconvenience.

@WebReflection Thank you very much. No need to apology. Those are your libraries and I'm the one using them. They are all great, so, again, thank YOU.