Skip to content

Commit

Permalink
fix: disable scroll restoration on playground
Browse files Browse the repository at this point in the history
  • Loading branch information
JuroUhlar committed Jul 15, 2024
1 parent 8187cd5 commit 0b5b9cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/playground/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { FunctionComponent } from 'react';
import { FunctionComponent, useEffect } from 'react';
import { CollapsibleJsonViewer } from '../../client/components/common/CodeSnippet/CodeSnippet';
import dynamic from 'next/dynamic';
import SignalTable, { TableCellData } from './components/SignalTable';
Expand Down Expand Up @@ -75,6 +75,13 @@ function Playground() {
serverError,
} = usePlaygroundSignals();

/**
* Prevent restoring scroll position on page refresh since there is nothing to scroll to while the data is being loaded
*/
useEffect(() => {
window.history.scrollRestoration = 'manual';
}, []);

if (agentError) {
return <Alert severity={'error'}>JavaScript Agent Error: {agentError.message}.</Alert>;
}
Expand Down

0 comments on commit 0b5b9cc

Please sign in to comment.