Skip to content

Commit

Permalink
fix has new changes check in edit dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
lovincyrus committed Dec 5, 2024
1 parent cbf50ce commit ec5dfb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,16 @@
return duplicateCount;
}
function handleFileUpload(event) {
const file = event.target.files[0];
function handleFileUpload(event: Event) {
const file = (event.target as HTMLInputElement).files?.[0];
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
const contents = e.target.result;
parseFile(contents);
checkForExistingKeys();
reader.onload = (e: ProgressEvent<FileReader>) => {
const contents = e.target?.result;
if (typeof contents === "string") {
parseFile(contents);
checkForExistingKeys();
}
};
reader.readAsText(file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
$: organization = $page.params.organization;
$: project = $page.params.project;
$: isEnvironmentSelected = isDevelopment || isProduction;
$: hasNewChanges =
$form.key !== initialValues.key ||
$form.value !== initialValues.value ||
Expand Down Expand Up @@ -347,13 +346,11 @@
<Button
type="primary"
form={$formId}
disabled={$submitting ||
!hasNewChanges ||
!isEnvironmentSelected ||
hasExistingKeys ||
$allErrors.length > 0}
submitForm>Edit</Button
disabled={$submitting || !hasNewChanges || hasExistingKeys}
submitForm
>
Edit
</Button>
</DialogFooter>
</DialogContent>
</Dialog>

0 comments on commit ec5dfb8

Please sign in to comment.