Skip to content

Commit 34f5fbc

Browse files
committed
Request current scroll position on initial mount
1 parent 51e8191 commit 34f5fbc

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

packages/react-devtools-shared/src/backend/views/Highlighter/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default function setupHighlighter(
2929
bridge.addListener('startInspectingHost', startInspectingHost);
3030
bridge.addListener('stopInspectingHost', stopInspectingHost);
3131
bridge.addListener('scrollTo', scrollDocumentTo);
32+
bridge.addListener('requestScrollPosition', sendScroll);
3233

3334
let applyingScroll = false;
3435

packages/react-devtools-shared/src/bridge.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ type FrontendEvents = {
256256
startProfiling: [StartProfilingParams],
257257
stopInspectingHost: [boolean],
258258
scrollTo: [{x: number, y: number}],
259+
requestScrollPosition: [],
259260
stopProfiling: [],
260261
storeAsGlobal: [StoreAsGlobalParams],
261262
updateComponentFilters: [Array<ComponentFilter>],

packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ function SynchronizedScrollContainer({
248248
useEffect(() => {
249249
const callback = scrollContainerTo;
250250
bridge.addListener('scrollTo', callback);
251+
// Ask for the current scroll position when we mount so we can attach ourselves to it.
252+
bridge.send('requestScrollPosition');
251253
return () => bridge.removeListener('scrollTo', callback);
252254
}, [bridge]);
253255

0 commit comments

Comments
 (0)