Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 14:36
    emugel edited #80
  • 14:34
    emugel edited #80
  • 14:34
    emugel edited #80
  • 14:25
    emugel closed #92
  • 14:25
    emugel commented #92
  • 14:19
    emugel edited #80
  • 14:17
    emugel opened #80
  • Dec 01 02:52
    emugel commented #90
  • Dec 01 02:13
    kevinresol commented #92
  • Dec 01 01:54
    emugel commented #92
  • Dec 01 01:46
    emugel commented #92
  • Dec 01 01:42
    emugel commented #92
  • Dec 01 01:42
    emugel commented #92
  • Dec 01 01:42
    emugel commented #92
  • Dec 01 01:32
    kevinresol commented #92
  • Dec 01 01:31
    emugel commented #92
  • Dec 01 01:31
    emugel commented #92
  • Dec 01 01:29
    emugel commented #92
  • Dec 01 01:29
    emugel commented #92
  • Dec 01 01:19
    emugel commented #92
Rudy Ges
@kLabz
Any idea why I get "Markup literals must be processed by a macro" when I add -lib coconut.react-dom to a react project? (that uses -D react-auto-jsx to wrap all @:markup expr in render in a jsx() call)
Also, should I use View instead of ReactComponent pretty much everywhere? (except externs)
Juraj Kirchheim
@back2dos
not necessarily ... coconut views are a bit heavier (particularly memory wise), but are pretty good at avoiding rerenders
as for the error, no idea ... please raise an issue in coconut.react-core
But yeah, had nodegui on my radar for a while now: MVCoconut/coconut.ui#83 ^^
Rudy Ges
@kLabz
It works nicely so far :P
Uldis Baurovskis
@hansagames

Hi, struggling a bit with coconut.ui for feathersui,
there are lot of object properties in feather framework, for example, layout, at the moment I create them as properties and then set their values in render method that is not very convient, but I could not find any other way. Maybe someone have better ideas how to handle such complex propreties in hxx?
Example code:

class TestView extends View {
    final verticalLayout = new VerticalLayout();
    public function render() {
        verticalLayout.gap = 10.0;
        return hxx('
            <LayoutGroup layout=${verticalLayout}>
                <TranslatedText
                    textId="game_play_content_1_text"
                    textCollection="rules"
                    style="rulesText"
                />
            </LayoutGroup>
        ');
    }
}

In react I add such stuff in constructor but as I understand coconut view can not have custom constructor

Scott
@scottPlusPlus
Is there a way to check I have haxeshim installed correctly? Anything I need to do other than
yarn global add haxeshim
Clark Jones
@clarkjones
Hi @kevinresol, Are there any known issues with vdom and storybook? Not sure what I'm missing here but I can't seem to get my components to display using storybook-coconut. The story nav is there and render functions are being called but not actually displaying. I had this working at one point with an older version of haxe and coconut though
Kevin Leung
@kevinresol
not sure... I only used react recently...
5 replies
Emugel
@emugel
say instead of a @:computed variable, one uses a function f(x:X):Promised<Y> (because computed properties can't have parameters). Would returning Promised<Y>provide automatic updates in the views? Or should one instead return Observable then bind it?
Kevin Leung
@kevinresol
you can keep track of the parameter and thus the result
@:editable var param:X;
@:computed var result:Promised<Y> = f(param);
but usually you don't want to produce Promised manually
but produce them via @:loaded instead
@:editable var param:X;
@:attr f:X->Promise<Y>;
@:loaded var result:Y = f(param);
Emugel
@emugel
right but then you need as many @:editable and @:computed entries as your variable X can take. So for 3 values you end up with 6 lines
or same in the second example. If you loaded a table, and you want to select a cell from this table, then you have to use a function
Kevin Leung
@kevinresol
you need to keep track of the selection somewhere anyway
I mean you will need a @:editable or @:observable for the cell address anyway
Emugel
@emugel
in my case they are not editable, it is simply like multiplication of tables based on rates
and i am wondering if it is ok to use Observable, or if i missed something
Kevin Leung
@kevinresol
In my experience, normally I don't need to use Observable manually
Emugel
@emugel
I will try your approach, one cell, one view. It's probably the simplest
Kevin Leung
@kevinresol
@back2dos is it possible to create a custom/adhoc reconciler+render in coconut?
like https://github.com/pmndrs/react-three-fiber which has a <Canvas> component and everything inside that has its own reconciler+render
Juraj Kirchheim
@back2dos
Anything is possible ... fundamentally, the view base class is something that accepts an Observable<RenderResult> (and a few callbacks) and then how that renders is the implementators business
but perhaps I don't quite understand your question
Juraj Kirchheim
@back2dos
what I can say is that conceptually, coconut.ui has no notion of a reconciler ... indeed coconut.html has none
Kevin Leung
@kevinresol
I don't fully understand it too, but what I guess is that I want to receive a sub-tree of the react virtual dom (coconut.react.RenderResult), perform custom reconcilation on it and render custom stuff with it. With all these happening within a larger react app.
but I now believe this shouldn't really involve coconut
Juraj Kirchheim
@back2dos
if it's react on both ends, I guess react can take care of it ^^
Rudy Ges
@kLabz
Emugel
@emugel
how do you guys make unit tests with coconut? first of all i'm interested in testing models. But let's say in general , what is your opinion of unit tests and coconut apps
Emugel
@emugel
maybe first i will see if i can have something simple with travix
Kevin Leung
@kevinresol
I wish to know too
Currently I have some tests for Models
and I want to make some UI tests using automation engines such as cypress.io
Emugel
@emugel

So, I discovered puppeteer with lix run travix run js, this seems like what I was dreaming of :).

Now however I am getting ReferenceError: require is not defined at this line var coconut_react_internal_NativeComponent = require("react").Component;. Is there anything I can do? (for now, all I see is ask the question and go grab some beers)

Emugel
@emugel
think this is the answer https://github.com/kLabz/haxe-react/blob/next/README.md#react-js-dependency (second compile with browserify or download from CDN). With travix though I don't know how
Emugel
@emugel
If someone knows, please help! For now will sleep...
Juraj Kirchheim
@back2dos
uhm, I suppose the easiest way to deal with it is by bundling a CDN version of react with the build using https://github.com/back2dos/embed-js
(and setting -D react_global)
Emugel
@emugel
Yay!! it works, thanks a lot!
Emugel
@emugel
Applying idea of https://github.com/MVCoconut/coconut.data#injecting-services (modularize models to reduce dependencies).
Imagine a Model with @:constant var server : { function foo():Promise<String>; }.
Called from travix or for unit test, this Model will be given a dummy function like ()->"Foo".
But when compiled in an App, the Model would receive a tink_web proxy, like tink.web.proxy.Remote<Something>.
While this Something has a function foo, it won't unite (because there seem to be subtleties in the macro), giving this error: tink.web.proxy.Remote1 should be { foo : () -> tink.Promise<String> }.
Any idea? It is not a big problem in itself, but I am trying to develop good habits and this is why I ask for the best way
Kevin Leung
@kevinresol
you cant really create a remote with method returning Promise<String>
because String is converted to IncomingResponse on client side
Emugel
@emugel
yes it was an example
Kevin Leung
@kevinresol
what happens if you put {foo: remote.foo}?
or even {foo: () -> remote.foo()}?
Emugel
@emugel
\o/ (both work, thanks!)