-
Notifications
You must be signed in to change notification settings - Fork 17
fix: ensure RemoteHookManager returns referencially equal results if … #157
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
base: main
Are you sure you want to change the base?
Conversation
@rawagner The |
That is exactly the problem I have - even though the Lets imagine this simple scenario: const useMyHook = () => {
const manager = useRemoteHookManager();
useEffect(() => {
manager.addHook({
scope: 'foo',
module: './bar',
});
}, [manager]);
// The problem - the results are always a new array
const results = manager.getHookResults()
return useMemo(() => {
//process results
}, [results])
} the |
Also if you compare the current memoization approach of The PR aligns the |
@rawagner OK understood. Can you re-install the dependencies please? I had a quick look already but I'll do a proper review later today. It did seem OK though :) Just wanted to know the details a bit more. |
I've created a separate PR - there seems to be quite a few entries missing in the lockfile - unrelated to this change - unless Im doing something wrong :) #158 |
@rawagner I think there might be issue with the relesae script, there was a bug with NX and lockfile updates (it was removing dev dependencies). |
0aaa794
to
94fe465
Compare
View your CI Pipeline Execution ↗ for commit 3822201
☁️ Nx Cloud last updated this comment at |
…they did not change
94fe465
to
3822201
Compare
rebased, thanks @Hyperkid123 |
…they did not change.
Previously
getHookResults()
always returned a new array, which may trigger unnecessary re-renders.The hook now returns array of results directly, not a function (
hookResults
vsgetHookResults
), which aligns better with React hooks design (IOW return reactive state right away)