We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a4e6e93 commit 41940e7Copy full SHA for 41940e7
packages/tasks/src/hooks/useScrollableHeight.ts
@@ -45,9 +45,24 @@ export function useScrollableHeight(
45
}
46
});
47
48
+ // Observe content child so the layout recalculates when
49
+ // the content is replaced (e.g. loading state -> form).
50
+ function observeContent() {
51
+ if (scroll?.firstElementChild) {
52
+ observer.observe(scroll.firstElementChild);
53
+ }
54
55
+
56
observer.observe(host);
57
observer.observe(scroll);
58
+ observeContent();
59
60
+ const mutations = new MutationObserver(observeContent);
61
+ mutations.observe(scroll, { childList: true });
62
- return () => observer.disconnect();
63
+ return () => {
64
+ observer.disconnect();
65
+ mutations.disconnect();
66
+ };
67
}, [hostRef, scrollRef]);
68
0 commit comments