Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choo Offline First #620

Open
sholtomaud opened this issue Jan 28, 2018 · 4 comments
Open

Choo Offline First #620

sholtomaud opened this issue Jan 28, 2018 · 4 comments

Comments

@sholtomaud
Copy link

Question

Loved the new documentation about Forms, but notice that the pattern uses fetch to POST data and then nothing more.

What is best practice for a choo offline first approach?

I was looking at Gunjs for database sync, however it is a bit green, and a very large library. Kind of an anti-pattern when compared to choo.

@yoshuawuyts
Copy link
Member

@shotlom heya, good question!

So this is a really tricky question, with no good answer. What you're asking for is how to eventually sync up values, and possibly roll back the results. This means doing some form of action that stores values inside IndexedDB until it's ready to be sent.

Generally my advice for this would be to not go down that path. Disable input fields if offline, and save yourself the trouble. If that's not an option, however, you can look into "syncable" databases like couchdb/pouchdb, and the newer hyperdb. None of which are going to be small, but that's the cost inherent to the problem.

Hope that answers your question!

@sholtomaud
Copy link
Author

Thanks @yoshuawuyts for the response.

I'm not sure if you've looked into Gun.js.db. It's an interesting approach inspired by couchdb. As you say, it's not small in size so rubs up against the choo motivation.

Enabled input fields is important for some use cases so ... what to do? Perhaps this issue can be a collection point for future options.

@sholtomaud
Copy link
Author

sholtomaud commented Feb 4, 2018

It would good to get your thoughts @yoshuawuyts on Geir's experiments for example with choo and gun.

https://github.com/zrrrzzt/choo-gun-test

@yoshuawuyts
Copy link
Member

@shotlom looks fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants