2 ms·
It was off the back of that talk that I was able to finally convince my team to go this route (back in 2019). They'd been trying to handle optimistic updates th
by aidos 3y ago
It was off the back of that talk that I was able to finally convince my team to go this route (back in 2019). They'd been trying to handle optimistic updates through Apollo and I was pushing the to make our own sync system over our mobx models to fix the DX.
After watching the talk we picked apart Linear's minified code to better understand the structure and then jumped on a call with Tuomas where he kindly filled any holes in our understanding.
Initially we tried to use IndexDB to give us more of the local-first features by caching between loads, but it was more hassle than it was worth. Instead we settled on live queries using Hasrua (we were a very early user / paying customer). We preload all the data that the user is going to need on app boot and then selectively load large chunks as they open their projects. These are then keeping mobx models up to date.
For mutating data we have a simple transaction system that you wrap around models to update them. It records and sends the mutations and makes sure that outstanding mutations are replayed over model changes locally.
We're not very "local-first" feature-wise; we don't handle conflicts perfectly, really relying on the fact that people are online and receive updates quickly. In practice it works.
Most importantly developers get a familiar graph of objects locally that they can just manipulate and not think about:
project.name = 'New name'
project.save()
PS https://www.countfire.com https://www.countfire.com (always looking for UK based devs to join the team)
EDIT Love your design work on Linear, Karri. You guys have made such an amazing product.