Git Product home page Git Product logo

Comments (6)

sars avatar sars commented on August 21, 2024

hi @kjanoudi
Could you please describe more detailed your case?
There is no such api to reload promises in asyncConnect decorator now
However changing location would reload them

from redux-async-connect.

kjanoudi avatar kjanoudi commented on August 21, 2024

Hi @sars,
As to this topic, what would it take to expose that kind of API? I think it would expand the usability of the asyncConnect package exponentially if we can allow reloading of the data without a location/route change.

Also, unrelated but I'm not sure if you saw my post here, that may help me understand better:
erikras/react-redux-universal-hot-example#928 (comment)

from redux-async-connect.

sars avatar sars commented on August 21, 2024

@kjanoudi ,
what interface would you expect for such API?
there is loadOnServer method that triggers loading

do you want to trigger just reloading of current route?
or you want to trigger it for specific route?

from redux-async-connect.

kjanoudi avatar kjanoudi commented on August 21, 2024

@sars Is the loadOnServer method able to be called from the client side? I was unclear, based on it's usage within the node.js code in the example, as well as the function name.

given this example:

@asyncConnect([{
  key: 'widgets',
  promise: ({helpers}) => helpers.client.get('/widget/load/param1/param2')
}])

It would be nice to be able to do something like pass in a dispatch method that would allow us to reload a prop based on it's key. Something like

import { loadAsync } from 'redux-async-connect';

handleClick(){
loadAsync('widgets')
}

Is that feasible?

from redux-async-connect.

sars avatar sars commented on August 21, 2024

@kjanoudi the problem is that key is global now. This means that you can use asyncConnect for different components with same keys.

what promise in your case loadAsync('widgets') it should invoke? ...

I thought... may be it make sense to define keys and promises for them in one place, like..

reduxAsyncConnect.init({
  widgets: ({helpers}) => helpers.client.get('/widget/load/param1/param2')
})

or something like this... and then use them in components, like:

@asyncConnect([{
  key: 'widgets',
  deferred: true,
  shouldUpdate: ...
}])

in this case function loadAsync('widgets') would definitely make sense..

from redux-async-connect.

kjanoudi avatar kjanoudi commented on August 21, 2024

@sars I was running under the impression that the keys would be/are unique. In that sense, a single key would always map to a single route/action.

from redux-async-connect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.