fix state loss after user switches from steps

This commit is contained in:
ShengYan, Zhang 2023-05-24 14:44:06 +08:00
parent fee38b8d13
commit e84da3089a

View File

@ -152,10 +152,10 @@ export function MessageExporter() {
index={currentStepIndex} index={currentStepIndex}
onStepChange={setCurrentStepIndex} onStepChange={setCurrentStepIndex}
/> />
<div
<div className={styles["message-exporter-body"]}> className={styles["message-exporter-body"]}
{currentStep.value === "select" && ( style={currentStep.value !== "select" ? { display: "none" } : {}}
<> >
<List> <List>
<ListItem <ListItem
title={Locale.Export.Format.Title} title={Locale.Export.Format.Title}
@ -186,8 +186,7 @@ export function MessageExporter() {
checked={exportConfig.includeContext} checked={exportConfig.includeContext}
onChange={(e) => { onChange={(e) => {
updateExportConfig( updateExportConfig(
(config) => (config) => (config.includeContext = e.currentTarget.checked),
(config.includeContext = e.currentTarget.checked),
); );
}} }}
></input> ></input>
@ -198,25 +197,19 @@ export function MessageExporter() {
updateSelection={updateSelection} updateSelection={updateSelection}
defaultSelectAll defaultSelectAll
/> />
</> </div>
)}
{currentStep.value === "preview" && ( {currentStep.value === "preview" && (
<> <div className={styles["message-exporter-body"]}>
{exportConfig.format === "text" ? ( {exportConfig.format === "text" ? (
<MarkdownPreviewer <MarkdownPreviewer
messages={selectedMessages} messages={selectedMessages}
topic={session.topic} topic={session.topic}
/> />
) : ( ) : (
<ImagePreviewer <ImagePreviewer messages={selectedMessages} topic={session.topic} />
messages={selectedMessages}
topic={session.topic}
/>
)}
</>
)} )}
</div> </div>
)}
</> </>
); );
} }