Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 15 09:45

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 15 09:45

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 15 09:44

    kevinresol on master

    Bump path-parse from 1.0.6 to 1… Merge pull request #16 from MVC… (compare)

  • Jan 15 09:44
    kevinresol closed #16
  • Jan 15 09:44

    kevinresol on master

    Bump postcss from 7.0.35 to 7.0… Merge pull request #20 from MVC… (compare)

  • Jan 15 09:44
    kevinresol closed #20
  • Jan 15 09:40
    dependabot[bot] edited #16
  • Jan 15 09:40
    dependabot[bot] edited #16
  • Jan 15 09:40
    dependabot[bot] synchronize #16
  • Jan 15 09:40

    dependabot[bot] on npm_and_yarn

    Bump path-parse from 1.0.6 to 1… (compare)

  • Jan 15 09:40
    dependabot[bot] edited #16
  • Jan 15 09:40

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 15 09:40
    dependabot[bot] closed #14
  • Jan 15 09:40
    dependabot[bot] edited #14
  • Jan 15 09:40
    dependabot[bot] commented #14
  • Jan 15 09:40
    dependabot[bot] labeled #20
  • Jan 15 09:40
    dependabot[bot] opened #20
  • Jan 15 09:40

    dependabot[bot] on npm_and_yarn

    Bump postcss from 7.0.35 to 7.0… (compare)

  • Jan 15 09:40
    dependabot[bot] edited #16
  • Jan 15 09:40
    dependabot[bot] edited #14
Kevin Leung
@kevinresol
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!)
Emugel
@emugel

Better I type here than add garbage to MVCoconut/coconut.ui#92. So after updating +tink state (1.0.0-beta.3) and core (2.0.2), the JS fails at the last line with process:

    var wasUpdating = tink_state_Observable.isUpdating;
        tink_state_Observable.isUpdating = true;
        return tink_core_TypedError.tryFinally(function() {
            var hrtime = process.hrtime();

process is not defined

that may be js.Node.process but why is it undefined?
Emugel
@emugel
:eyes: forget it. if I try to run it from a browser of course process is not defined...
Juraj Kirchheim
@back2dos
but shouldn't you get an exception instead of nothing?
Kevin Leung
@kevinresol
A question on patterns for async data source, which one is better?
class OverviewPage extends View {

    @:attr var data1:Promised<Data1>;

    @:attr var getData2:()->Promise<Data2>;
    @:loaded var data2:Data2 = getData2();

    @:attr var getData3:()->Promise<Data3>;

    @:attr var data4:Model4;


    function render() '
        <Widget1 data=${data1} />
        <Widget2 data=${data2} />
        <Widget3 getData=${getData3} />
        <Widget4 data=${data4} />
    ';
}

class Model4 implements Model {
    @:attr var getData:()->Promise<Data4>;
    @:loaded var data:Data4 = getData();
}
Juraj Kirchheim
@back2dos
phew ... it depends ^^
Kevin Leung
@kevinresol
yeah I am using each of them all over the place....
serjek
@serjek
attr is allowed in Model?
Kevin Leung
@kevinresol
should be @:constant
but you get the idea
serjek
@serjek
yeah. so I tend to use 1 and 4, because I believe services should belong to model
Juraj Kirchheim
@back2dos
myeah, ideally your application should be able to run without a view
although to create a model only for the sake of having one piece of loaded data is a bit overkill ^^
Kevin Leung
@kevinresol
yeah I think my app can run without a view. but my views can't run without the app data.
Juraj Kirchheim
@back2dos
:D
Kevin Leung
@kevinresol
mainly because my models store a reference to a tink_web remote instance
now whenever I wanted to test my view isolated I need to prepare a remote
I think I prefer #1 in most of the cases but it is not very ergonomic when it comes to optional attribute
and I even proposed to add @:promised var data:Data1 as a shorthand of #1
Juraj Kirchheim
@back2dos
yeah ... ideally the model wouldn't really depend on a remote proxy
one option is to make a @:genericBuild class Like<T> {} that takes an interface/class and returns a structure corresponding to it
then you can go @:constant var services:Like<Remote<Api>> and you can stick in a remote, but during tests just an anonymous object that returns what you want it to
or you can have an interface for your model and then one implementation is build on remotes and another is just a mock that is easy to set up for tests
Emugel
@emugel
I have ModalWindow extends View.
And in the App class, static function modal(modal:ModalWindow) { ... ; Renderer.mount( div, modal); }.
But the second argument of Rendered.mount has to be RenderedResult; so what is the recommended way to render a view? (render() is private, so that's not it right?)
Emugel
@emugel
to answer my own question, for now I can modal(view:RenderResult) and then modal(<ModalWindow>..</ModalWindow>), should be good enough
Juraj Kirchheim
@back2dos
yep
Thomas J. Webb
@thomasjwebb
How feasible is it to use something like antd (https://ant.design) with coconut or just haxe-react? I'm having issues making haxe externs for antd's typescript but also wondering if there will be other snags I'd hit trying to use its components, preferably in a coconut-ui-based app.