Comments (3)
Hello! Really happy to know that Render works for you guys.
I've pushed 799385a today that should mirror React's shouldUpdateComponent.
You should be able to skip the component reconfiguration by simply adding override ovveride var shouldUpdate: Bool { return false }
in your UIComponent
subclass.
note: The render method is still going to be called per se, but just to keep the vdom in sync, no UIView hierarchy manipulation will take place.
from render.
Just had a read through and a go with the shouldUpdate implementation - the main aspect I can see it lacking against the React equivalent is that it doesn't necessarily catch the props on the way in for a comparison.
What I've done with a couple of components is add a property observer to the props which sets and stores an Optional of the last props we saw - shouldUpdate then is overridden to return a comparison from the last props vs the current ones. As said - we aren't strictly dealing with equatables in the props so this gives us a chance to do more complex logic to determine whether we should(n't) update.
Given the structure that could be easily added into the Component classes, but I've yet to properly test and see if we are actually saving time and update counts as a result. I'll let you know when I have something.
For consideration too - I've been looking at whether it would be simple to implement a means for a child to update in isolation. I'm thinking of the trivial things like a button which changes colour on a state change and then calls setNeedsRender on itself - isolating prop changes to children could be easy but layouts might be harder given a child may grow. Is there any optimisation around that which I've missed? My goal is to not have to do a layout() run over the whole view if I can be sure its not needed.
from render.
Just to let you know where we got to with the new shouldUpdate - we were hoping that we'd be able to completely isolate a section of the tree from the layout aspect more than anything - our cycles currently have layout taking ~10x the time of diff/reconcile.
Edited: Urgh no - apologies. My debugger stack pointed me in some odd directions there. I can see a non-root component returning false for shouldUpdate and all the children reporting false, as they should. This should mean that even though markDirty should not be being called for this node and its children, it appears that Yoga still spends time doing the layout on them (as we only see improvements to layout time when the node is completely omitted from the tree).
I might read up on Yoga and how it handles its own updates before asking any more silly questions
from render.
Related Issues (20)
- What happened to ComponentCollectionViewCell? HOT 1
- Classic Version does not compile on clean CocoaPods install HOT 2
- No control over a ComponentView's contentView HOT 1
- UICollectionView support? HOT 2
- Updating a panning view fails to HOT 4
- RenderNeutrino issue with cacaopod headers(device) HOT 1
- Question: why is .flexibleHeight a default for non-scrolling UIComponentViewControllers? HOT 2
- Carthage support broken since version 5.2
- AppKit Support? HOT 3
- Struct vs Class for UIProps/UIState HOT 1
- Use of _kvcKeyPathString for the identifier in AnyKeyPath extension HOT 2
- REQUEST: Simple Example of how to use CollectionViews with Render Neutrino?
- Write documentation.
- Is Render cross-platform?
- Build List component.
- Ensure RenderInspector works with Neutrino.
- Build more examples in the catalog.
- Port Documentation. HOT 5
- Neutrino: table component layout performance HOT 5
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 render.