Comments (14)
I'm not going to fix observ-array tonight.
There's a bunch of complexity in this problem domain. observ-struct
was hard enough.
from mercury.
@Raynos can you please describe the problem? thanks
from mercury.
@Raynos this may provide some insight... not sure if it's too slow though... but thought it might help...
https://github.com/benjamine/jsondiffpatch
from mercury.
I think we fixed observ-array, cannot remember.
from mercury.
See this issue ( Raynos/observ-array#9 ). cc @kuraga
I never verified whether all the edgecases were handled.
Also see nrw/observ-varhash#1
from mercury.
Hm... It's difficult to understand, when notes about issues are posted in different components' repositories 😄
from mercury.
@kuraga distributed conversations :) hard to find them.
It's also not fully documented what two way data binding means. it basically means that if you mutate either the parent or child in both the parent & child get updated.
var parentArr = hg.array();
var childArr = hg.array();
parentArr.push(childArr);
childArr.push(4);
parentArr.get(0).get(0) === 4;
parentArr.set([
[5]
])
childArr.get(0) === 4;
parentArr.get(0).get(0) === 5;
I'm not really sure what I want the semantics to be in all the edge cases tbh... Whatever makes time travel work.
The whole point is to be able to serialize the entire state of the world at any time and bring it back at any other time. which means appState.set(bigComplexObject)
should propogate the changes down correctly to all the places.
from mercury.
An
ObservVarhash
is a version ofobserv-struct
that allows adding and removing keys. Mutation of an observable element in the hash will cause theObservVarhash
to emit a new changed plain javascript object.
@nrw does it mean than we can use observ-varhash
as a replacement of observ-struct
in mercury?
from mercury.
@kuraga observ-varhash
does everything that observ-struct
does, so we could use it as a replacement. I always use struct
when i know my keys are static and i use varhash
when i know they'll change. are you just looking to reduce dependencies?
from mercury.
I'm looking everything to understand every line of mercury
😄
from mercury.
i see. :)
If you look at the source, varhash
is just struct
with a bunch of bookkeeping for adding and removing keys. You could just use varhash
all the time, if you like.
from mercury.
I use struct to communicate "these are fixed keys"
I use varhash to communicate "there are N keys"
There is a different, a struct can be like struct({ n: string, m: number })
A varhash should be homogenous so each key should have the same shape varhash({ a: componentT, b: componentT })
from mercury.
I'm not really sure what I want the semantics to be in all the edge cases tbh... Whatever makes time travel work.
@Raynos or anyone, could you explain this a little further (what would/wouldnt make time travel work, what are examples of edge cases in the context of Raynos sample above)? im a bit new to all this, but may contribute as im noticing observ-array being a bottleneck in my project
from mercury.
@cellvia last time I looked at this I observed that using varhash
instead of array
is better in general.
Most of the time you have an array of objects; you can just create a varhash indexed by id or
from mercury.
Related Issues (20)
- live component reloading HOT 6
- Mercury not exporting virtual-hyperscript SVG HOT 2
- Immutable props
- question: how to detect if a widget has been unmounted HOT 2
- Communication between child components
- Why static render methods? HOT 3
- Using vdom-to-html doesn't work (returns empty string) HOT 6
- Redux + mercury example? HOT 10
- lock down wiki?
- syntax of h HOT 2
- npm install fails HOT 1
- 14.1.0 break all VNode input rendering HOT 8
- newb question HOT 4
- Docs/Introduction: Simple Cycle example missing
- Synchronize tagged version and comment in mercury.js
- Rendering subitems of different types HOT 4
- What is the right way to pass data to click event handlers? HOT 1
- Get the previous version of state var HOT 3
- Splitting components out to their own render loop? HOT 2
- How to attach state to renderer? HOT 10
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 mercury.