Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preact compatibility: error on undefined parent in memoizeSize() #254

Closed
nolanlawson opened this issue Dec 18, 2018 · 3 comments · Fixed by #285
Closed

Preact compatibility: error on undefined parent in memoizeSize() #254

nolanlawson opened this issue Dec 18, 2018 · 3 comments · Fixed by #285
Labels

Comments

@nolanlawson
Copy link

Hi there, great library, thanks so much for making it. 🙂

I'm working on creating an emoji picker that lazy-loads emoji-mart as well as React (since my project does not use React). I've found remount to be a great way to bundle this library as a custom element, but I'd also like to use Preact to get the bundle size down.

Unfortunately when I use Preact with the standard Webpack configuration:

resolve: {
  alias: {
    'react': 'preact-compat',
    'react-dom': 'preact-compat'
  }
}

This results in the following error in the console:

category.js:84 Uncaught (in promise) TypeError: Cannot read property 'getBoundingClientRect' of undefined
    at Category.memoizeSize (category.js:84)
    at NimblePicker.updateCategoriesSize (nimble-picker.js:436)
    at NimblePicker.componentDidUpdate (nimble-picker.js:187)
    at renderComponent (preact.mjs:601)
    at rerender (preact.mjs:88)

Here's where the error happens:
screenshot from 2018-12-17 19-14-38

Interestingly, it doesn't seem to actually affect the functionality of the component itself, but it is a noisy error in the console. Maybe this is a bug in preact-compat, or maybe this is fixable in emoji-mart?

@nolanlawson
Copy link
Author

It also seems like inferno-compat does not have this same problem. So it may just be a problem with preact-compat.

@nolanlawson
Copy link
Author

FWIW it also appears to work fine with react-lite. So this is apparently really just an issue with preact-compat. Closing this bug, since there are plenty of decent alternatives. :)

@nolanlawson
Copy link
Author

Reopening because I think I can fix this.

nolanlawson added a commit to nolanlawson/emoji-mart that referenced this issue Feb 5, 2019
nolanlawson added a commit to nolanlawson/emoji-mart that referenced this issue Feb 5, 2019
nolanlawson added a commit to nolanlawson/emoji-mart that referenced this issue Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant