fix: 🐛 reset active file on form reset
This commit is contained in:
parent
9dfbfcdb35
commit
e07fb03500
@ -350,7 +350,10 @@ function Organizrr() {
|
|||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
c="red"
|
c="red"
|
||||||
onClick={() => form.reset()}
|
onClick={() => {
|
||||||
|
form.reset();
|
||||||
|
setActiveFile(null);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<IconRestore />
|
<IconRestore />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
@ -392,7 +395,7 @@ function Organizrr() {
|
|||||||
</Group>
|
</Group>
|
||||||
<ScrollArea offsetScrollbars>
|
<ScrollArea offsetScrollbars>
|
||||||
<Group wrap="nowrap" align="start">
|
<Group wrap="nowrap" align="start">
|
||||||
{form.values.files[activeFile].documents.map((d, idx) => (
|
{form.values.files[activeFile]?.documents.map((d, idx) => (
|
||||||
<Stack
|
<Stack
|
||||||
key={`${d.id}-${idx}`}
|
key={`${d.id}-${idx}`}
|
||||||
h={500}
|
h={500}
|
||||||
@ -462,12 +465,12 @@ function Organizrr() {
|
|||||||
.find(
|
.find(
|
||||||
(doc) =>
|
(doc) =>
|
||||||
doc.id ===
|
doc.id ===
|
||||||
form.values.files[activeFile].documents[0].id
|
form.values.files[activeFile]?.documents[0].id
|
||||||
)
|
)
|
||||||
?.file.name.endsWith(".pdf") && (
|
?.file.name.endsWith(".pdf") && (
|
||||||
<Stack
|
<Stack
|
||||||
w={300}
|
w={300}
|
||||||
key={form.values.files[activeFile].documents.length}
|
key={form.values.files[activeFile]?.documents.length}
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
label="Add file"
|
label="Add file"
|
||||||
|
Loading…
Reference in New Issue
Block a user