Skip to content

Commit

Permalink
fix: toInt function now only apply if the parameter is a number
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoTomeES committed Aug 13, 2023
1 parent 5a73671 commit 169a9f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@
// Fix error when currentPage is string, once it is introduced with the page input
// @see https://stackoverflow.com/a/72418699/17157571
const toInt = (x) => (currentPage = parseInt(x));
const toInt = (x) => {
if (!isNaN(x) && x !== "") currentPage = parseInt(x);
};
$: toInt(currentPage);
</script>
Expand Down

0 comments on commit 169a9f2

Please sign in to comment.