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

Flush debounced changes when form is unmounted #799

@FelixHenninger

Description

@FelixHenninger

Hi everybody, hi @davidkpiano,

thanks for creating this awesome library! It is truly super-helpful, and I very much enjoy using it. This is more of a suggestion/enhancement than a bug: I'm not sure whether this issue should be responsibility of the library. I might also be applying the LocalForm wrong — any hints or suggestions would be very welcome!


The Problem

Form debouncing works perfectly by itself. However, when the form is removed from the page / unmounted, any changes that are still delayed by the debouncing are lost.

Steps to Reproduce

In the example, make a change to the form and change the UI state before the debounce delay is reached. The onChange callback does not get called, and the change is lost.

Expected Behavior

It would (in my view) be fantastic if the debouncing could be flushed when either the form or the control is removed/unmounted from the app, so that any remaining changes are applied.

Actual Behavior

Pending changes are lost.

Reproducible Code Example

I've put together a very basic example at https://codepen.io/anon/pen/pPmjGZ . I sincerely hope it makes sense, and would be happy to make changes or answer questions.


I would be glad to help with resolving this issue if that were ok with you, though it might take some talking through the RRF internals for me to be able to help effectively. Again — it might well be that my approach is wrong, and I would be happy to learn in that case.

Thanks again, and the best regards,

-Felix

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions