jollyjerr/react-autosave

onSave not triggered if value evaluate to false

ockam opened this issue ยท 3 comments

ockam commented

In the useAutosave.tsx, when evaluating if onSave will be called, if the value is falsy (empty string, 0), onSave is not called.

    if (initialRender.current) {
      initialRender.current = false;
    } else if (debouncedValueToSave) {
      onSave(debouncedValueToSave);
    }

You should remove this check.

P.S. thanks for this great hook!

This is great, thank you! I'll let you know when it's patched ๐Ÿ™‡๐Ÿผ

closed by #14

Patched in 0.4.0 ๐ŸŽ‰