Skip to content

Commit

Permalink
fixed reactivity in _slider
Browse files Browse the repository at this point in the history
  • Loading branch information
kwongz committed Feb 12, 2025
1 parent c73ecbb commit e77188a
Showing 1 changed file with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import InlineError from '../InlineError.svelte';
import checkRequiredProps from '../checkRequiredProps.js';
import checkInputs from '@evidence-dev/component-utilities/checkInputs';
import { browserDebounce } from '@evidence-dev/sdk/utils';
/////
// Component Things
Expand Down Expand Up @@ -76,12 +75,6 @@
let errors = [];
/** @type {[number]} */
let value;
// const updateUrl = useUrlParams(name, (v) => {
// value = v ?? defaultValue;
// });
function validateNumber(value, valueType) {
value = toNumber(value);
if (isNaN(value)) {
Expand All @@ -107,7 +100,7 @@
checkMinMax(min, max);
}
$: if (defaultValue !== undefined && !data) {
if (defaultValue !== undefined && !data) {
defaultValue = validateNumber(defaultValue, 'defaultValue');
if (defaultValue < min) {
errors.push('defaultValue cannot be less than min');
Expand All @@ -118,15 +111,11 @@
}
// Keep inputs in sync
$inputs[name] = value;
$: $inputs[name] = value;
// URL params hydration
// hydrateFromUrlParam(name, (v) => {
// value = [v] ?? [defaultValue];
// });
hydrateFromUrlParam(name, (v) => {
if (v) {
if (v[0]) {
value = [v];
}
});
Expand Down

0 comments on commit e77188a

Please sign in to comment.