Skip to content

load data deferred #55

Open
Open
@andresgutgon

Description

@andresgutgon

Hi, I'm trying to figure out how to fetch 2 things: 1 always on server and client, and the second one only on server. I'm trying to follow this code: erikras/react-redux-universal-hot-example#928

But if I do in that way, with filter only on client I always fetch both things. Because it's not filtered on server code in any way.

I've tryed to add filter on loadOnserver function in this way:

      loadOnServer(
        {
          ...renderProps,
          store,
          helpers: {client},
          filter: (item) => !item.deferred,
        }
      ).then(() => {

and deferred thing looks like this:

@asyncConnect([{
  deferred: true,
  promise: (options) => {
    return options.store.dispatch(loadDeferredThing(options.params.id));
  },
}])

And it works! It do not make this request (loadDeferredThing) on server.

The problem is not doing on client neither :/

Only when I go to other place in the app and back both request are done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions