Preserve Editor State (#151)

This commit is contained in:
Gregory Schier
2024-12-31 07:31:43 -08:00
committed by GitHub
parent 31f2bff0f6
commit 135c366e32
33 changed files with 295 additions and 177 deletions

View File

@@ -110,7 +110,7 @@ function ActualEventStreamViewer({ response }: Props) {
function FormattedEditor({ text, language }: { text: string; language: EditorProps['language'] }) {
const formatted = useFormatText({ text, language, pretty: true });
if (formatted.data == null) return null;
return <Editor readOnly defaultValue={formatted.data} language={language} />;
return <Editor readOnly defaultValue={formatted.data} language={language} stateKey={null} />;
}
function EventStreamEventsVirtual({

View File

@@ -89,6 +89,7 @@ export function TextViewer({
defaultValue={filterText}
onKeyDown={(e) => e.key === 'Escape' && toggleSearch()}
onChange={setFilterText}
stateKey={`filter.${responseId}`}
/>
</div>,
);
@@ -113,6 +114,7 @@ export function TextViewer({
isSearching,
language,
requestId,
responseId,
setFilterText,
toggleSearch,
]);
@@ -165,6 +167,7 @@ export function TextViewer({
language={language}
actions={actions}
extraExtensions={extraExtensions}
stateKey={null}
/>
);
}