fix(runtime): tigger didDomUpdate when Implwrapper update

This commit is contained in:
Bowen Tan 2022-11-09 15:27:02 +08:00
parent a99d711218
commit 0b1e2f0931

View File

@ -28,14 +28,16 @@ export function useEleRef(props: ImplWrapperProps) {
if (eleRef.current && !isInModule) {
eleMap.set(c.id, eleRef.current);
}
hooks?.didDomUpdate && hooks?.didDomUpdate();
return () => {
if (!isInModule) {
eleMap.delete(c.id);
}
hooks?.didDomUpdate && hooks?.didDomUpdate();
};
// These dependencies should not change in the whole life cycle of ImplWrapper.
// Otherwise, the clear function will run unexpectedly
}, [c.id, eleMap, isInModule, stateManager.store]);
}, [c.id, eleMap, hooks, isInModule, stateManager.store]);
return {
eleRef,