Comments (6)
Hello @luccitan. Normally, baobab
is not meant to hold anything else than "raw" data. Classes aren't therefore supported as it is quite impossible to reliably clone an instance in every JS engine. There are ways to kinda fake cloning instance but they might have some undesirable side effects.
From here, you have another option, if you really want to keep classes: you can disable the tree's persistence (and hence lose its advantages but, it can be done if persistence is not what you need).
var tree = new Baobab({}, {persistent: false});
If you do so, baobab will only mutate objects given and won't try to shift references along the path by cloning.
from baobab.
Yes you can. It just means you wonβt get pure rendering performance gain (which you dont have by default anyway).
from baobab.
It works wonderfully! π
Can you explain a little bit more the persistent
option please ?
I have read through its documentation in the README but I didn't think it was the solution of my problem.
I would appreciate further information about its usefulness, as I may need the tree's history later. (It's not a concern at the moment)
from baobab.
Persistence is basically useful for 2 use cases:
- You need to track the history of the data and may want to go back in time easily.
- You need to be able to determine whether two states of the data are identical or not based only on referential equality
===
without having to perform a diff.
from baobab.
No. 2 is very useful with view engines like React that can beneficiate from shouldComponentUpdate
callbacks that can just check whether references are identical to be able to take the decision to render again or not.
from baobab.
Does that mean that I can't use baobab-react
with a Baobab tree without persistence ? π€
from baobab.
Related Issues (20)
- question on immutable in production HOT 6
- Memory leak when overwriting monkeys HOT 1
- how to remover a listener HOT 2
- Monkey in an array HOT 3
- Listening to elements in Array not working with strings HOT 2
- Events are not firing up in IE11 HOT 7
- Integration with flowtype HOT 5
- Option to disable monkeys HOT 3
- Other parts of tree fire events when deepMerge HOT 2
- Using Baobab 2.5.1 is causing babel to fail HOT 5
- Support ES Modules HOT 3
- Question regarding releasing cursors HOT 2
- Compatiblity issue with babel-preset-env introduced in version 2.5.1 HOT 19
- Unify output from tree events and cursor events HOT 2
- Infinite loop when adding DOM element HOT 3
- Support structural equality for keys HOT 8
- Generic types for get, set, select, and apply; immutability for apply callback input HOT 9
- Add a security policy HOT 2
- Force monkey recalculation 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 baobab.