Fix for field modal infinite render loop once closed from click away (#42)

This commit is contained in:
Conor_Mack 2019-12-04 22:13:06 +00:00 committed by Michael Shanks
parent 5a2ffac934
commit 0e0369052c
2 changed files with 42 additions and 41 deletions

View File

@ -11,7 +11,7 @@ let listenerAdded = false;
$: {
if(ukModal && !listenerAdded) {
listenerAdded = true;
ukModal.addEventListener("hide", onClosed);
ukModal.addEventListener("hidden", onClosed);
}
if(ukModal) {

View File

@ -39,6 +39,7 @@ store.subscribe($store => {
editingField = true;
}
onFinishedFieldEdit = (field) => {
if(field) {
store.saveField(field);
@ -139,7 +140,7 @@ const nameChanged = ev => {
{/if}
{#if editingField}
<Modal bind:isOpen={editingField}>
<Modal bind:isOpen={editingField} onClosed={() => onFinishedFieldEdit(false) }>
<FieldView field={fieldToEdit}
onFinished={onFinishedFieldEdit}
allFields={record.fields}