mvcoconut / coconut.diffing Goto Github PK
View Code? Open in Web Editor NEWPlatform agnostic diffing algorithm to render and update UI hierarchies
License: The Unlicense
Platform agnostic diffing algorithm to render and update UI hierarchies
License: The Unlicense
May only be the case with older versions though.
When using <Implicit defaults={...}>
, components using @:implicit
objects in render/@:computed
/etc. will get the instance defined in defaults={...}
while components only using @:implicit
in a callback (onClick for example) will get the @:default
instance instead.
Edit: if view is created later on, it will also default to @:default
instance instead of the one defined in defaults={...}
A view that uses a computed property stops getting rendered after a particular sequence of changes to the values of the observables that the computed property depends on.
After a day debugging this weird issue, I've come up with a minimalistic example with which I can reproduce it consistently.
Project download link: https://we.tl/t-3UroiwKtkX
haxe build.hxml
.bin/index.html
in the browser.isVisible
, displayed on the last line)In case a OuterView class have an InnerView class, the calling of afterPatching of the OuterView happens before the patching of the InnerView finishes.
So the order looks like this:
The expected order should be like this:
I am getting this error:
/usr/local/lib/haxe/lib/coconut,ui/0,9,0/src/coconut/ui/macros/Generator.hx:63: characters 55-64 : Type not found : TagCreate
I'm not convinced this isn't my fault, and it could be a compiler regression also
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VNativeBase.hx:42: characters 15-16 : Null<coconut.ui.Ref<coconut.diffing.internal.RNativeBase.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VNativeBase.hx:69: characters 17-18 : Null<coconut.ui.Ref<coconut.diffing.internal.RNativeBase.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VNativeBase.hx:73: characters 17-18 : Null<coconut.ui.Ref<coconut.diffing.internal.RNativeBase.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VNativeBase.hx:85: characters 15-16 : Null<coconut.ui.Ref<coconut.diffing.internal.RNativeBase.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VWidget.hx:42: characters 15-16 : Null<coconut.ui.Ref<coconut.diffing.internal.RWidget.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VWidget.hx:55: characters 17-18 : Null<coconut.ui.Ref<coconut.diffing.internal.RWidget.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VWidget.hx:59: characters 17-18 : Null<coconut.ui.Ref<coconut.diffing.internal.RWidget.Concrete>> cannot be called
/mnt/dat/lib/haxe/coconut,diffing/git/src/coconut/diffing/internal/VWidget.hx:71: characters 15-16 : Null<coconut.ui.Ref<coconut.diffing.internal.RWidget.Concrete>> cannot be called
specific calls look like
switch v.ref {
case null:
case f: f(widget);
}
which seems legit where ref is Null<Ref<...>>
Ideally should contain an example on how to create a coconut.ui backend with this.
It looks like occasionally not all invalid children are rerendered. To make matters worse this requires relatively complex trees to reproduce.
The fix of #5 sometimes leads to refs not being properly set back to null upon removal.
The anonymous object may impact performance (although perhaps negligibly, compared to construction / update).
For @nadako
delete
would be useful, also in cases when you need to unload some dynamic texture from VRAM etc
class Frag extends View {
@:state var show:Bool = false;
function render() {
return (
<div>
<if {show}>
<>
<span>Hello </span>
<span>world</span>
</>
</if>
<button onclick={show = !show}>switch fragments</button>
</div>
);
}
}
Clicking the button first time shows spans, clicking the second time crashes the app with Uncaught (in promise) Error: assert
in coconut_vdom__$Renderer_DomCursor.delete()
.
Fragments here are not necessary of course, but the same error occurs if <Implicit />
is used instead
<if {show}>
<Implicit defaults={[ Frag => this ]}>
<span>Hello </span>
<span>world</span>
</Implicit>
</if>
React does not complain about such using of fragments btw.
With fragment it fails with String should be coconut.diffing.VNode<js.html.Node>
<>
${Std.string(1)}
</>
but works with a div
<div>
${Std.string(1)}
</div>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.