-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix hook expr optimization and add optimization steps #20
Conversation
@SukkaW I'm sorry I had to remove the check (although it is likely to be removed in the future, but I just found out a simpler solution). Initially I was theorizing the optimization process was divided in three steps:
It seems that step 1 is unnecessary but step 3 seems to be more likely, however I don't see it achieving yet so I had to make sure that the hook problem is solved as early as possible (the 3 step optimization is supposed to solve it). |
Awesome! This sounds better than the current check implementation. In the mean time, there might be more edge cases to cover. I can start using |
Okay I've decided to add the optimization steps. |
is-contains-hook
was proved to be problematic in some scenarios (e.g.useEffect(() => ..., [useA()])
so this PR changes it so that:Some minor fixes:
false
if the hook's scope binding exists however this isn't the expected case if the hook function is globally declared.Edit:
This PR now also adds 3 new optimization steps:
Here's an example code that has been optimized by the new step: