Skip to content

Commit

Permalink
fix(client): clear error when file is uploaded (#271)
Browse files Browse the repository at this point in the history
* fix(client): hide no file or content error when file is uploaded

* lint
  • Loading branch information
Zoobdude authored Oct 15, 2024
1 parent 13c9144 commit 39ebe5b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ export const CreateNotePage: Component = () => {
setError(null);
}

function updateUploadedFiles(files: File[]) {
setUploadedFiles(prevFiles => [...prevFiles, ...files]);
setError(null);
}

const getIsShareApiSupported = () => navigator.share !== undefined;

const shareNote = async () => {
Expand Down Expand Up @@ -209,7 +214,7 @@ export const CreateNotePage: Component = () => {
</TextFieldRoot>

<div>
<FileUploaderButton variant="secondary" class="mt-2 w-full" multiple onFilesUpload={({ files }) => setUploadedFiles(prevFiles => [...prevFiles, ...files])}>
<FileUploaderButton variant="secondary" class="mt-2 w-full" multiple onFilesUpload={({ files }) => updateUploadedFiles(files)}>
<div class="i-tabler-upload mr-2 text-lg text-muted-foreground"></div>
{t('create.settings.attach-files')}
</FileUploaderButton>
Expand Down

0 comments on commit 39ebe5b

Please sign in to comment.