Coder Social home page Coder Social logo

Web support planned? about drift HOT 9 CLOSED

simolus3 avatar simolus3 commented on May 22, 2024 2
Web support planned?

from drift.

Comments (9)

simolus3 avatar simolus3 commented on May 22, 2024 7

sql.js is looking more promising indeed, I managed to get a minimal prototype with persistence working. What still needs to be done:

  • Transactions
  • Batched statements
  • Returning the insert id for INSERT statements
  • The new "before open but after migrations" callback from version 1.5
  • Tests!

from drift.

simolus3 avatar simolus3 commented on May 22, 2024 4

Started some work for this on the web branch, I hope to make a working prototype out of that next week.

from drift.

simolus3 avatar simolus3 commented on May 22, 2024

I've already taken a quick look at AlaSQL and considered adding web support for moor using that library in the past. The effort would depend entirely on how different AlaSQL is to sqlite, I didn't take an in-depth look yet. I'll do that soon.

from drift.

JulianBissekkou avatar JulianBissekkou commented on May 22, 2024

Great news, let me know when it's ready. I will have a look at it with my team then! :)

from drift.

simolus3 avatar simolus3 commented on May 22, 2024

Sorry for the delay on this. Unfortunately, AlaSQL has some issues which makes it really hard to work with. It doesn't support some sqlite functions, doesn't persist table changes (so default values will be gone when reloading the page) and doesn't really support migrations. I've used some hacky workarounds to counter some of these problems, but the whole thing is still very unreliable. It also doesn't seem to be very well maintained, having many important issues open for a long time.

I'll try sql.js next. It requires webassembly, but that should be available on most modern browsers anyway. The big advantage is that it will behave exactly the same as sqlite, although persisting changes is a bit tricky at the moment.

from drift.

simolus3 avatar simolus3 commented on May 22, 2024

So this landed in develop and will be a part of moor 1.6! I've written some documentation on how to use moor for the web here.

If you want to try this out now, you'll need to use a dependency override pointing to the moor/ folder on the develop branch in this repo. Also, don't consider the format in which the database is stored finalized yet, it will be changed (which breaks existing databases) before version 1.6 is released publicly.

Here is the source code for a simple todo app built using moor and flutter for web. It's deployed here. You can see the sql statements sent in the console. Web support is not optimized for performance yet, so it can take a while to show/add entries.

from drift.

JulianBissekkou avatar JulianBissekkou commented on May 22, 2024

Really cool 💪🏼! Thanks for the effort 🙏🏻!
I will try it out and give you feedback asap.

from drift.

simolus3 avatar simolus3 commented on May 22, 2024

FYI, the breaking encoding change is now on develop - the way databases are stored is final now, but you need to localStorage.clear() pages where you've already used moor for web.

Also, web support now lives on beta and I'll hopefully release it on pub later this week. Closing this issue now as web support is done. If you run into any issues, please let me know by opening another issue, thanks!

from drift.

simolus3 avatar simolus3 commented on May 22, 2024

If you're using (or plan on using) drift with web apps, I'm currently looking for feedback to help get this feature stable. So if you have the time, sharing feedback about the ideas in #2382 would help stabilize this feature!

from drift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.