davidmfoley / react-router-modal

Simple modals for react-router 4
MIT License
153 stars 20 forks source link

Usage with preact #28

Open danielgek opened 6 years ago

danielgek commented 6 years ago

Hi, i'm trying to use this with preact and i get an error described here If outDelay is 0 the bug doesn't happen, when you add a delay it triggers the above error

The error is in this line

Changing the if condition to fixes the problem:

if (!modals || modals.length === 0) {
  return null;
}

I don't know if this is the right fix or if it's another thing that's not right @davidmfoley what do you think ? Also @developit i saw that you answered that stackoverflow question, do you have any idea ?

davidmfoley commented 6 years ago

I don't know enough about preact to be able to help out here. Might it have something to do with preact's handling of a component where the state is initialized "inline" rather than via an explicit setState call?

davidmfoley commented 5 years ago

I think I found and fixed this bug in version 1.5.1. Please let me know if you get a chance to test it.