Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit b129687

Browse files
committed
fix(TextField): fix displaying numeric value
1 parent 02cf91e commit b129687

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/svelte-materialify/src/components/TextField/TextField.svelte

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script>
2+
import { afterUpdate } from 'svelte';
23
import Input from '../Input';
34
import Icon from '../Icon';
45
import uid from '../../internal/uid';
@@ -34,6 +35,10 @@
3435
$: labelActive = !!placeholder || value || focused;
3536
let errorMessages = [];
3637
38+
afterUpdate(() => {
39+
if (typeof value !== 'string') value = (value ?? '').toString();
40+
});
41+
3742
export function validate() {
3843
errorMessages = rules.map((r) => r(value)).filter((r) => typeof r === 'string');
3944
if (errorMessages.length) error = true;

0 commit comments

Comments
 (0)