Comments (5)
Sure, I think using MobX as a local state management system + WatermelonDB as the database should work just fine.
from watermelondb.
Interesting!
But wouldn't it cause related component to be updated twice every time some value changes?
for example,
// mobX part
@observable myColor
// watermelon part
...color.value = myColor...
user changes @observable myColor ->
mobX will update related component ->
mobX's changed observable value will update watermelon's color.value ->
watermelon will update related component again
This is what I think might happen when using MobX and WatermelonDB together.
Is this wrong or is this perfectly okay?
from watermelondb.
I don't get it. Why do you want to use both MobX and Watermelon to manage the same data? I get using MobX as local-state-only library, but why go through MobX to modify persistent data?
from watermelondb.
oh, now I see.
This is my first time trying backend myself.
So I got all mixed up about how to deal with data.
I'll try using MobX + WatermelonDB then!
Thanks for the quick reply :)
from watermelondb.
This thread is the first search result, so I’ll post it here. Unless I’m missing something—withObservables()
can’t be combined with observer()
HOC—when you have multiple HOCs, you’re supposed to apply observer()
first, but observer()
memoizes components, and you should memoize after withObservables()
. If you apply observer()
last, an error is thrown; if you apply observer()
first, everything is now memoized, and changes to WatermelonDB
models don’t rerender components. As far as I can tell, there’s no way to work around this—at least not in a way that’s mentally tolerable.
I don’t know how any of this work, but perhaps, it’ll become possible when and if WatermelonDB
switches to a hook. I’d also like someone to confirm this, and until someone does, it would be best to take this message with a grain of salt and set up a basic WatermelonDB
+MobX
project to see the issues for yourself.
from watermelondb.
Related Issues (20)
- TypeError: Super expression must either be null or a function HOT 2
- Can we get current migration versions like fromVersion and toVersion
- Different between using `@lazy` decorator vs getter?
- Support for Expo SDK50 HOT 1
- Error: [withObservable] Value passed to withObservables doesn't appear to be observable. See console for details
- Observer with pagination not working
- Unable to resolve module ./internal/operators/timeout from E:\eventual-mvp-app\node_modules\rxjs\dist\cjs\index.js:
- Installation guide HOT 1
- Sync pull HOT 1
- Unable to run between query Because number field in schema treated as string in SQLite DB HOT 2
- Unable to use sortBy option for joining table with use of clause HOT 1
- Unable to push sync TypeError: Cannot read property 'type' of undefined at _setRaw HOT 5
- Automatic create/update tracking not working in react native 0.73.1 HOT 6
- [Question] 0.27.1 does not export "action" from Database any more HOT 1
- "TypeError: SQLiteAdapter is not a constructor" when using Svelte(Kit) and CapacitorJS HOT 2
- @leejunhui I have the same problem. Just migrated to Vite + Typescript and the _raw fields are empty. Did you get it running in the end?
- Developing a Tauri Database Adapter, multiple errors HOT 1
- Wrong type definition in LocalStorage get HOT 1
- Diagnostic error: Unsafe name 'undefined' not allowed (not a string) HOT 1
- Cannot read property 'observe' of undefined HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watermelondb.