dependabot[bot] on npm_and_yarn
Bump terser from 4.8.0 to 4.8.1… (compare)
dependabot[bot] on npm_and_yarn
Bump simple-plist from 1.1.1 to… (compare)
back2dos on v1
Add key value iterator to Child… (compare)
dependabot[bot] on npm_and_yarn
Bump cross-fetch from 3.1.4 to … (compare)
dependabot[bot] on npm_and_yarn
Bump async from 2.6.3 to 2.6.4 … (compare)
dependabot[bot] on npm_and_yarn
Bump minimist from 1.2.5 to 1.2… (compare)
back2dos on v1
Slightly better Attribute imple… (compare)
class Team implements coconut.data.Model {
@:editable var color : String;
}
class World implements coconut.data.Model {
@:editable var colors : List<String> = List.fromArray(['red', 'green']);
@:computed var teams : List<Team> = colors.map( k -> new Team({color:k}) );
}
In this example, any time colors
will be edited, I think the objects in teams
will be entirely rebuit. But when each team is complex enough, with @:loaded
and what not, it is not very good. I am trying to find a way for them to persist but keeping @:computed
if possible. Or is there a better approach
@:computed
you can also access the last value as $last
which is an Option
(because on the first computation it is None
) ... it's a little less straightforward, but since the previous value is discarded after the computation, you need not worry about keeping too many stale values around
class V extends View {
@:state var num : Int = 0;
@:attr var setVal : Int->Void = (n:Int) -> num = n;
function render() <>
<input type="number" defaultValue={Std.string(num)} />
<button onclick={setVal(24)} value="24" />
<button onclick={setVal(37)} value="37" />
</>;
}
this renders _0__ [ 24 ] [ 37 ]
, however on the react-dom
backend (only), clicking the buttons 24 and 37 won't change the input. I think this is a problem that can not be fixed for now and instead it has to be worked around, but does anybody understands what's wrong in the first place?
V.num
in this case becomes an @:attr
and setVal
loses its default callback) I have the same problem. There has to be a secrete recipe!
coconut.vdom
set defaultValue
and value
directly (i.e. the properties of the DOM API), whereas react has some odd opinionated way to apply these differently ... defaultValue
corresponds to thevalue
attribute which provides the initial value for the value
property ... it is also the value that's assumed by the value
property if the parent form is reset ... so long as the user hasn't entered a value on their own (or value
was set via JavaScript
), then altering defaultValue
will alter the input's value
@:ref var field:InputElement; function render() <><input type="number" ref=${field} />...</>; function viewDidMount() untilUnmounted(Observable.autorun(() -> field.defaultValue = num))
to make it work in react-dom, but that's not overly advisable ... in essence you either have to live with the differences in behavior, or you can make a separate view just for text inputs that behaves consistently
Is there a way to ask for a certain view to be manually unmounted. Or how would you do it? Here is the case:
There's this bootstrap function I have to open modal windows (modal dialog or popups).static function modal(view:RenderResult) { divModal = document.createDivElement(); /* add some classes to divModal*/ document.body.appendChild( divModal ); Renderer.mount(divModal, view); }
. Also something like static function modalClose() document.body.removeChild(something);
One little piece of view that I want to show in that modal window has a lifecycle method ( override function viewDidMount() { var handle = setInterval(someTask,4000); beforeUnmounting(() -> clearInterval(handle); }
).
But of course the beforeUnmounting()
is never called because it is injected artificially. And someTask
keep on running.
Any thoughts on this?
defaultValue
or value
props on <select> instead of setting selected
on <option>.". This is in a <select ...><option selected={bool}>....</select>
. But when I try to use value= on the <select>
it seems it is not recognized by tink_domspec
. Is there something to do here? (the warning is annoying me although it works)
tink.web.proxy.RemoteEndpoint is not observable, because tink.web.proxy._Remote.RemoteEndpointData is not ↪observable, because Field headers
of { scheme : tink.web.proxy._Remote.Scheme, ?query : Null<tink.web.proxy.QueryParams>, ?pathSuffix : Null<String>, ? ↪path : Null<tink.web.proxy._Remote.PathFragments>, host : tink.url.Host, ?headers : Null<tink.web.proxy._Remote.Headers> }
needs to have write access never
Any thoughts? :0
I may as well keep it in a regular var, it's just I am starting thinking about rescue servers, and thus endpoint that can change