Closed dpwrussell closed 7 years ago
Hey @dpwrussell ,
I don't think we ever parsed anything in the middleware–a lot of that happened in Link
previously. I moved the parsing to the action creators for a few reasons:
Link
can: parsing queries, normalizing string/object "hrefs", requesting query persistence, etc.persistQuery
handling to the reducer because the action creators don't have access to the current state (and we don't want to require redux-thunk
for this)I'll add a note in the action creator section discouraging the use of the bare action types. I might consider removing them from the export list as well so they're not public API anymore 😄
OK. Definitely don't remove them from exports though as there are middleware reasons to need those. I.e. intercepting actions.
On Fri, 30 Jun 2017, 02:20 Tyler Paul Thompson, notifications@github.com wrote:
I don't think we ever parsed anything in the middleware–a lot of that happened in Link previously. I moved the parsing to the action creators for a few reasons:
- We want the action creators to do anything Link can: parsing queries, normalizing string/object "hrefs", requesting query persistence, etc.
- We had to move persistQuery handling to the reducer because the action creators don't have access to the current state (and we don't want to require redux-thunk for this)
I'll add a note in the action creator section discouraging the use of the bare action types. I might consider removing them from the export list as well so they're not public API anymore 😄
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_FormidableLabs_redux-2Dlittle-2Drouter_issues_196-23issuecomment-2D312185346&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=hG980ESxUhpWXeq9BOrnOv3CUpq5lW8uGu7OdRUzoVI&m=g0vffCFnQS4ROno6rrlhhKylN4A0agJIIESYEzr4bmI&s=a2gHRk9oRVFFKLewM1jfIa5zoUAp4X_R5GS40azTZJ4&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ABzTEz8jxkyZ4gu4h7e-2D09myosSYuYwhks5sJJOigaJpZM4OHKsz&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=hG980ESxUhpWXeq9BOrnOv3CUpq5lW8uGu7OdRUzoVI&m=g0vffCFnQS4ROno6rrlhhKylN4A0agJIIESYEzr4bmI&s=v_2rJsrOn2xV_RXZmZsrH2RnFVALwk4mTkRYlrB1dCk&e= .
As there were no action-creators in RLR, I was using
PUSH
type like so.I just upgraded to 14.0.0-0 to test an upgrade and my middleware stopped working because there seems to have been a switch from parsing the query parameters in the middleware, to doing it in the action-creator I think.
If I do the above now, I will get an action with the correct
pathname
andsearch
, but with nothing in thequery
object.Given that using
PUSH
was necessary until recently, I think this deserves to be prominent in the action-creator section of the documentation at the least. It actually seems like potentially more of a bug as I don't see what advantage is gained by moving some of the router behaviour.Minimal demo example: https://github.com/dpwrussell/RLRQueryIssueDemo