Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    tayloriex
    @tayloriex
    I have an API call that I would like to show a message while it is loading
    Darío Javier Cravero
    @dariocravero
    @julen if you have the data right after the app is created you can either set the stores' states before loading any views, or, probably more aligned to flux you could fire the action yourself
    Darío Javier Cravero
    @dariocravero
    @tayloriex I guess you have to do it yourself since as far as I know there's no abstraction for it in flummox
    marty has an abstraction around fetching that essentially keeps track of the state of stuff your store needs that's being requested by an asynchronous mechanism, like a call to an external service
    it works in sync with the container which lets you deal with pending, done and failed
    having worked with that abstraction for a while I think it's handy but I don't know if it's 100% needed
    Darío Javier Cravero
    @dariocravero

    In that implementation marty keeps track of every remotely fetched property of a store separately within the store, so, say your store holds a GitHub user with all its repos, you get the user and its list of repos separately with two separate fetches.

    If you were to do it yourself (probably a cleaner approach) you could have two stores, one for the user and one for the repos and hold an internal state for it that tells whether it has data or it's fetching it from a remote source. Your app would then be aware of that fact and you would get a "status" property in your store's state that you can now leverage within your views.

    J u l e n
    @julen
    @dariocravero thanks! actually I found my mistake (PEBKAC), and firing the action in componentWillMount()WFM
    Darío Javier Cravero
    @dariocravero
    @julen good stuff :)
    Darío Javier Cravero
    @dariocravero
    Josh Girvin
    @girvo
    Yes!!! I got Mocha, Sinon and Mockery working together with Flummox to unit test async actions, mocking classes and more :D
    Josh Girvin
    @girvo
    Hey, so if an Async Action is calling a service and handing whatever it receives (be it an error or real data) to the Store, should it await on the external service or should the Store await?
    Hugo Dozois
    @dozoisch
    @girvo the action should await.
    the store will received the "data_fecth"event or whatever onces it's fetched
    Jeffrey Morgan
    @jeffdm
    On the errors topic: where should we handle errors? should all errors go into stores or can we throw them in actions and catch them in views?
    Josh Girvin
    @girvo
    Yeah @dozoisch — sounds good to me
    @jeffdm — the actions are what are talking to the stores and the views just look at the stores themselves, so I feel it makes more conceptual sense for the errors to go into the stores which the views can watch for :)
    Darío Javier Cravero
    @dariocravero
    @jeffdm I agree with @girvo, Stores are responsible for that and, from my experience, it's better to trigger different actions for errors, as in, data_fetch_failed, so that the logic in the store is simpler to understand
    Patrick Burtchaell
    @pburtchaell
    Hey, I'm having an issue with listenToStores if anyone is around.
    Josh Girvin
    @girvo
    Hi all
    Having an issue with unit testing async actions — it’s not added to a Flux instace (obviously) so it complains about using the action dirctly
    You've attempted to perform the asynchronous action APIActions#sendRequest, but it hasn't been added to a Flux instance.
    Darío Javier Cravero
    @dariocravero
    @pburtchaell sorry for the delay, what's up?
    @girvo have you thought about mocking the app with the actions?
    Patrick Burtchaell
    @pburtchaell
    @dariocravero No worries. I got it figured out.
    Darío Javier Cravero
    @dariocravero
    @pburtchaell cool :)
    Johan Alkstål
    @johanalkstal
    So I'm looking at the Immutable-Store and I'm wondering, what's left to do with it? It says WIP?
    yujinlim
    @yujinlim
    is there any example projects that uses flummox?
    Morteza Shahriari Nia
    @mshahriarinia
    Anybody online?
    How does flummox take care of routes like ./todos or /todos/:id are these done by react-router or express Restful API? or some flumox magic?
    Chris Beckett
    @chrismbeckett
    @mshahriarinia I am using react-router
    My main application file setups up the router, routes, and any objects that I want on the overall application context (like the top-level Flux container). Then the router passes those props to my main applicaiton component, that puts them on the context so they are available to any component down the stack...
    Morteza Shahriari Nia
    @mshahriarinia
    do you have any snippets? From my understanding you need to define all the routes in express (e.g. with a prefix of './api') to be able to get json (restful) and the redefine the normal routes (without ./api) for react isomorphism goodness.
    If you only want to have react routes then who takes care of DB access, server side control and logic. You definitely dont want to send your server logic and pack it and send it to client.
    Chris Beckett
    @chrismbeckett
    @mshahriarinia Yeah, thats right, react-router handles the navigation in the SPA in the browser, but if you are also building a RESTful API, then you have to have some server-side routes for the API in Express
    Morteza Shahriari Nia
    @mshahriarinia
    Oh man! I thought there is a DRY way to reuse routes and keep consistency between RESTFUL routes and client react-routes.... hmmm
    Chris Beckett
    @chrismbeckett
    @mshahriarinia Certainly not that I am aware of. If you use something like MeteorJS that has both a client and server component in the framework, then the Iron Router allows you define routes that span client and server, but I have not seen that in another framework.
    Morteza Shahriari Nia
    @mshahriarinia
    @chrismbeckett Thanks man! appreciate it. I asked the same concept on Stackoverflow http://stackoverflow.com/questions/30272154/isomorphic-javascript-routes-with-react-route-vs-rest-api-routes/30293432#30293432 but the answer didn't make too much sense to me
    @chrismbeckett Do you have any clues what that man replies?
    Chris Beckett
    @chrismbeckett
    @mshahriarinia He is basically telling you the same thing, just not very clear. The point he is trying to make is that your server-side routes need to be isoloated (e.g. under an /api/) path in Express on the server, so that when React-Router runs in the client it doesn't screw up calling your REST API.
    Morteza Shahriari Nia
    @mshahriarinia
    I see, I see. Thank you again! Cheers
    Chris Beckett
    @chrismbeckett
    @mshahriarinia This is a standard issue when you are serving your web application and the REST API on the same domain whether you are doing an SPA (Single Page App) or not. You need to design a seperation of concern between the routes that are for your web app, and the routes for your API.
    Morteza Shahriari Nia
    @mshahriarinia
    true
    Eric Fields
    @ericdfields
    an issue i'm having, not sure if flummox or babel is my problem: https://gitter.im/babel/babel?at=555b5ee3076ab5646e6e29cb
    Konstantin
    @slyder
    Hello, i have isomorphic application with user authentication and in action i should have user cookies to pass them to action request . For now i pass express req variable into performRouteHandlerStaticMethod method, and then repass to action in routerWillRun method
    here is gist: https://gist.github.com/slyder/a66848456b99987ade79#file-gistfile1-txt
    Which is the best way to do it?
    Darío Javier Cravero
    @dariocravero
    @ericdfields it might be binding, have you tried MyAppGlobal.socket.bind('data',this.methodB.bind(this))?
    paulwehner
    @paulwehner
    What is the difference between flummox and alt? why would you choose one over the other?
    Darío Javier Cravero
    @dariocravero
    @paulwehner I'm currently using both Marty and Flummox_ and even though I'm pretty confident with _Marty's codebase, I've been finding _Flummox way simpler to understand and hack around (which I think is very important as it gives you confidence with the code). It doesn't have all of the things that _Marty has (like StateSources (which is an abstraction to some utils to connect to APIs, etc.) and de/rehydration out of the box) but the way it's put together makes it very easy to extend it.
    I haven't had a chance to really try alt_, but from what I remember, when you use it with flux instances you get something rather similar to _Flummox, at least in syntax.
    Kamil Lelonek
    @KamilLelonek
    is gitter or slack more used for Flummox?
    Daniel Dunderfelt
    @danieldunderfelt
    @KamilLelonek Ha! I think you have an answer to yor question :shipit: