From 51d635bc12f28a129ed2449557c14b1ed6b708d9 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sat, 6 Aug 2022 18:59:28 +0300 Subject: [PATCH] fixed popup hide --- forms/collection_upsert.go | 11 ++++++----- ui/src/components/settings/ImportPopup.svelte | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/forms/collection_upsert.go b/forms/collection_upsert.go index c753c897..0435692f 100644 --- a/forms/collection_upsert.go +++ b/forms/collection_upsert.go @@ -45,20 +45,21 @@ type CollectionUpsertConfig struct { // If you want to submit the form as part of another transaction, use // [NewCollectionUpsertWithConfig] with Dao configured to your txDao. func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert { - form := NewCollectionUpsertWithConfig(CollectionUpsertConfig{ + return NewCollectionUpsertWithConfig(CollectionUpsertConfig{ Dao: app.Dao(), }, collection) - - return form } // NewCollectionUpsertWithConfig creates a new [CollectionUpsert] form // with the provided config and [models.Collection] instance or panics on invalid configuration // (for create you could pass a pointer to an empty Collection instance - `&models.Collection{}`). func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *models.Collection) *CollectionUpsert { - form := &CollectionUpsert{config: config} + form := &CollectionUpsert{ + config: config, + collection: collection, + } - if form.config.Dao == nil || collection == nil { + if form.config.Dao == nil || form.collection == nil { panic("Invalid initializer config or nil upsert model.") } diff --git a/ui/src/components/settings/ImportPopup.svelte b/ui/src/components/settings/ImportPopup.svelte index 2fac91b3..86eac0b1 100644 --- a/ui/src/components/settings/ImportPopup.svelte +++ b/ui/src/components/settings/ImportPopup.svelte @@ -118,9 +118,9 @@ ApiClient.errorResponseHandler(err); } - hide(); - isImporting = false; + + hide(); } @@ -128,6 +128,8 @@ bind:this={panel} class="full-width-popup import-popup" overlayClose={false} + escClose={!isImporting} + beforeHide={() => !isImporting} popup on:show on:hide @@ -172,11 +174,12 @@ - +