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

LoadSavedData - Treat as a transaction #93

Open
ish-joshi opened this issue Jul 13, 2020 · 2 comments
Open

LoadSavedData - Treat as a transaction #93

ish-joshi opened this issue Jul 13, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@ish-joshi
Copy link

Realtime support

I was attempting to build a real time drawing board using Firebase database when I realised something very strange.

I am using the onChange handler to be notified of any updates so that they can be written to the database.

Once new data is received, it is passed to the component to be re-drawn. As it redraws each line, the onChange is triggered for each line, which causes an infinite loop.

What do the creators/maintainers think about treating the whole loadSaveData() as a transaction; after all lines are drawn the change notification is published. I already have made changes to the existing library and tested to make sure it works.

Check out this fork (https://github.com/ish-joshi/react-canvas-draw) and I'm happy to raise a PR if maintainers/contributors agree with the approach.

@HenryLeC
Copy link

I am doing the same thing in my app, and I just dont update the database while loadSaveData is running

@embiem embiem added the bug Something isn't working label Nov 7, 2021
@embiem
Copy link
Owner

embiem commented Nov 7, 2021

Seems like a bug to me tbh. If you'd still be interested to create a PR, then please do so.

Otherwise I'll pull the changes from your fork.

Thanks for reporting this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants