@modular-forms/preact
Advanced tools
Comparing version
@@ -41,27 +41,27 @@ import { batch } from '@preact/signals'; | ||
return () => { | ||
store.consumers.delete(consumer); | ||
// Mark field as inactive if there is no other consumer | ||
batch(() => { | ||
if (!keepActive && !store.consumers.size) { | ||
store.active.value = false; | ||
// Reset state if it is not to be kept | ||
if (!keepState) { | ||
reset(form, name); | ||
// Otherwise just update form state | ||
setTimeout(() => { | ||
store.consumers.delete(consumer); | ||
// Mark field as inactive if there is no other consumer | ||
batch(() => { | ||
if (!keepActive && !store.consumers.size) { | ||
store.active.value = false; | ||
// Reset state if it is not to be kept | ||
if (!keepState) { | ||
reset(form, name); | ||
// Otherwise just update form state | ||
} | ||
else { | ||
updateFormState(form); | ||
} | ||
} | ||
else { | ||
updateFormState(form); | ||
} | ||
} | ||
}); | ||
// Remove unmounted elements | ||
if ('elements' in store) { | ||
setTimeout(() => { | ||
}); | ||
// Remove unmounted elements | ||
if ('elements' in store) { | ||
store.elements.value = store.elements | ||
.peek() | ||
.filter((element) => element.isConnected); | ||
}); | ||
} | ||
} | ||
}); | ||
}; | ||
}, [form, name, store, keepActive, keepState]); | ||
} |
{ | ||
"name": "@modular-forms/preact", | ||
"description": "The modular and type-safe form library for Preact", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -47,9 +47,9 @@ "author": "Fabian Hiller", | ||
"@types/eslint": "^8.37.0", | ||
"@typescript-eslint/eslint-plugin": "^5.57.0", | ||
"@typescript-eslint/parser": "^5.57.0", | ||
"eslint": "^8.37.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.5", | ||
"@typescript-eslint/parser": "^5.59.5", | ||
"eslint": "^8.40.0", | ||
"eslint-config-preact": "^1.3.0", | ||
"preact": "^10.13.2", | ||
"typescript": "4.9.5", | ||
"vite": "^4.3.3", | ||
"vite": "^4.3.5", | ||
"zod": "^3.21.4" | ||
@@ -56,0 +56,0 @@ }, |
@@ -7,3 +7,3 @@ # Modular Forms | ||
- Small bundle size starting at 2.5 KB | ||
- Small bundle size starting at 3 KB | ||
- It's fast – DOM updates are fine-grained | ||
@@ -10,0 +10,0 @@ - Type safety with autocompletion in editor |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
260873
0.05%