Skip to content
Discussion options

You must be logged in to vote

This will be fixed in the next version of Preact (10.5.14). If you're waiting for that, here's a patch you can drop anywhere into your project that fixes the issue in Preact 10+:

import { options } from 'preact';
let old = options.__h;
options.__h = (c, i, type) => {
  if (type === 9) {
    let hooks = c && (c.__H || (c.__H = { __: [], __h: [] })) && c.__H.__;
    if (!hooks[i]) hooks[i] = Object.defineProperty({}, '__c', DESC);
  }
  if (old) old(c, i, type);
};
const DESC = {
  get() { return this.c },
  set(v) { this.c = typeof v === 'function' ? Object.assign({}, v) : v },
};

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@areuin-AH
Comment options

Comment options

You must be logged in to vote
1 reply
@Inviz
Comment options

Comment options

You must be logged in to vote
2 replies
@developit
Comment options

@heyushuo
Comment options

Answer selected by joshuaellis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants