Skip to content

Commit

Permalink
fix: do not dispatch "complete" event on mount (#26)
Browse files Browse the repository at this point in the history
Fixes #21
  • Loading branch information
jneuendorf-i4h authored Jun 13, 2024
1 parent 8f9861a commit a301f8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Pincode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
focusNextInput(idx);
},
add: (id, value) => {
let _code = [...code];
const _code = [...code];
_ids.update((_) => {
if (code[_.length] === undefined) {
Expand Down Expand Up @@ -157,7 +157,7 @@
$: _type.set(type);
$: _selectTextOnFocus.set(selectTextOnFocus);
$: value = code.join("");
$: complete = code.filter(Boolean).length === $_ids.length;
$: complete = code.length > 0 && code.filter(Boolean).length === $_ids.length;
$: if (code) {
_ids.update((_) => {
return _.map((_id, i) => ({ ..._id, value: code[i] }));
Expand Down
4 changes: 2 additions & 2 deletions src/unstyled/Pincode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
focusNextInput(idx);
},
add: (id, value) => {
let _code = [...code];
const _code = [...code];
_ids.update((_) => {
if (code[_.length] === undefined) {
Expand Down Expand Up @@ -157,7 +157,7 @@
$: _type.set(type);
$: _selectTextOnFocus.set(selectTextOnFocus);
$: value = code.join("");
$: complete = code.filter(Boolean).length === $_ids.length;
$: complete = code.length > 0 && code.filter(Boolean).length === $_ids.length;
$: if (code) {
_ids.update((_) => {
return _.map((_id, i) => ({ ..._id, value: code[i] }));
Expand Down

0 comments on commit a301f8d

Please sign in to comment.