markdalgleish/redial

Good way to prevent fetching when route changes?

johanneslumpe opened this issue · 1 comments

I'm trying to transition an app to use redial but I have the need to prevent possible refetches based on conditions involving comparison of the previous and next params. My current custom implementation uses component hooks and works much like a resolver (with multi-pass rendering on the server).

Given a route /something/:id/:segment I want to prevent data fetching if :segment changes and allow it if :id changes. @markdalgleish Do you have any pointers how to make this work? I feel that I have to use something like redux-react-router to gain access to the previous params in the match which gets executed in history.listen. Would love to hear your thoughts on this and maybe a different approach if you happen to have one.

I just figured it might be as easy as storing parts of renderProps in a variable outside of history.listen and then pass those as locals as well.