question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Continuation of #698 - Redux time travel

See original GitHub issue

@tmeasday,

I went back and played around with time travel a bit. What seems to be popping out of the blue when I reset my store are APOLLO_QUERY_STOP actions. I’m not sure if these should be happening or not. Maybe you can shed some light on this?

Nevertheless, I’m realizing that time traveling a react-apollo app isn’t really possible because data from the graphql higher order component gets called on componentDidMount. This means that as you try to reproduce each step, once you get to the step that would mount the GraphQL connected component, the queries are going to fire off, thus overlapping with the next actions one would manually dispatch while time traveling.

It’s definitely possible to reduce the state from all the actions though. 😄

EDIT: Starts where this comment left off.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:40 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
zalmoxisuscommented, Sep 24, 2016

@migueloller, I’ve just published redux-devtools-instrument@1.2 and remote-redux-devtools@0.4.9, which support this feature. We still need to update the UI (add a button) on remotedev-app (and the extension), however you can get it work just by calling in your app:

store.liftedStore.dispatch({ type: 'LOCK_CHANGES', status: true });

To unlock changes:

store.liftedStore.dispatch({ type: 'LOCK_CHANGES', status: false });

Please let me know whether it helps.

1reaction
zalmoxisuscommented, Oct 7, 2016

@tmeasday, thinking over, I don’t think we should force users to add redux-thunk middleware, better to execute side effects right from (new ApolloClient()).middleware() for specific action types:

function clientMiddleware(store) {
  return next => action => {
    const result = next(action);
    // ...
    if (action.type === 'SUBSCRIBE_REQUEST') {
      // network requests or other sideffects
      // here we can dispatch also: next({ type: 'SUBSCRIBE_SUCCESS' })
      // or: next({ type: 'SUBSCRIBE_FAILED' })
    } else if (action.type === 'TEARDOWN_REQUEST') {
      // network requests or other sideffects
    }
    return result;
  };
}

And from the component:

  componentDidMount() {
    this.props.dispatch({ type: 'SUBSCRIBE_REQUEST' });
  }
  componentWillUnmount() {
    this.props.dispatch({ type: 'TEARDOWN_REQUEST' });
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Time Travel in React Redux apps using the Redux DevTools
The Redux DevTools records dispatched actions and the state of the Redux store at every point in time. This makes it possible to...
Read more >
Build time travel debugging in Redux from scratch
In this tutorial we will go step-by-step through building time travel debugging from scratch. We will begin by covering the core principles of...
Read more >
Redux DevTools Time Travel fails to update UI correctly (only ...
I'm trying your code right now and it does not seem to have a problem with the Time Travel feature in my browser...
Read more >
scp don t look at me
Specialties: Ideal for the adventure traveler or cultural seeker, our Hilo hotel is the ... Line of sight must not be broken at...
Read more >
Get the Cheapest Airline Tickets with These Apps - oy23.com
Finding cheap airline tickets is a traveler's dream. ... Instead, it searches real-time flight prices to find you the best price at that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found