@marianmeres/stuic 3.77.0 → 3.77.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,6 +95,7 @@
95
95
  </script>
96
96
 
97
97
  <script lang="ts">
98
+ import { untrack } from "svelte";
98
99
  import { twMerge } from "../../utils/tw-merge.js";
99
100
  import { t_default } from "./_internal/register-form-i18n-defaults.js";
100
101
  import {
@@ -146,6 +147,22 @@
146
147
  // Internal validation errors (set on submit)
147
148
  let internalErrors = $state<RegisterFormValidationError[]>([]);
148
149
 
150
+ // Clear internal field errors as soon as the user edits any tracked field, so a
151
+ // previous failed-submit's errors don't linger after the user has fixed them.
152
+ // Re-validation on the next submit will repopulate `internalErrors` if anything
153
+ // is still wrong. `untrack` for the read+write so this effect only re-runs on
154
+ // formData changes — otherwise `handleSubmitValid` setting `internalErrors`
155
+ // would immediately re-fire this effect and wipe the errors back out.
156
+ $effect(() => {
157
+ void formData.email;
158
+ void formData.password;
159
+ void formData.passwordConfirm;
160
+ for (const f of extraFields) void formData.extra?.[f.name];
161
+ untrack(() => {
162
+ if (internalErrors.length) internalErrors = [];
163
+ });
164
+ });
165
+
149
166
  // Merge internal + external errors; external takes precedence per field
150
167
  let allErrors = $derived.by(() => {
151
168
  const map = new Map<string, string>();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.77.0",
3
+ "version": "3.77.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",