We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f2df9b commit 644f19cCopy full SHA for 644f19c
1 file changed
packages/react-moveable/src/utils.tsx
@@ -1677,10 +1677,16 @@ export function watchValue<T>(
1677
defaultValue?: T,
1678
): T {
1679
const store = (moveable as any)._store;
1680
- const prevValue = store[property];
+ let prevValue = store[property];
1681
1682
if (!(property in store)) {
1683
- store.property = defaultValue;
+ if (defaultValue != null) {
1684
+ store[property] = defaultValue;
1685
+ prevValue = defaultValue;
1686
+ } else {
1687
+ store[property] = nextValue;
1688
+ return nextValue;
1689
+ }
1690
}
1691
if (prevValue === nextValue || valueKey(prevValue) === valueKey(nextValue)) {
1692
return prevValue;
0 commit comments