Remove the behaviour in history of comparing dispatched push/back actions to the previous/next route, and converting them into back/next actions when they match. This behaviour is confusing/unexpected and hard to work around in the case that you do want to e.g. push the previous route again. Apps that want that behaviour can implement it by explicitly dispatching back/next actions in the first place.
Remove the option in setParams/setState etc history functions to pass a function rather than a raw value (e.g. setQuery((query) => ({ ... query, counter: query.counter+1}). This is because:
It did not work consistently. It worked for set/back/next actions but not for push/replace actions, and the params version received the query as an argument)
It isn't necessary, because the user can access the current values before they dispatch the action.
Remove the merging of params/query/state in history set actions (similar reasons)
Remove the ability to pass state in back/next history actions. This can easily be done on the app side by dispatching first a set action, and then back/next
Tests
A small number of tests which existed to test the removed behaviours were removed.
A small number of tests have changed snapshots and assertions to reflect the new behaviour.
Many tests were updated to explicitly dispatch back/next actions where previously they relied on the auto back/next behaviour. This means alot of the snapshots have next turning into push, but are otherwise the same
Unfortunately the diff for packages/integration-tests/__tests__/integration/actions/__snapshots__/history.js.snap looks huge - I think its a result of changing the number of snapshots in each test. AFAICT, nothing has changed that is not clear from the diff of the test file itself.
Fixes https://github.com/respond-framework/rudy/issues/48
Changes
setParams
/setState
etc history functions to pass a function rather than a raw value (e.g.setQuery((query) => ({ ... query, counter: query.counter+1})
. This is because:params
version received thequery
as an argument)params
/query
/state
in history set actions (similar reasons)state
inback
/next
history actions. This can easily be done on the app side by dispatching first aset
action, and thenback
/next
Tests
next
turning intopush
, but are otherwise the samepackages/integration-tests/__tests__/integration/actions/__snapshots__/history.js.snap
looks huge - I think its a result of changing the number of snapshots in each test. AFAICT, nothing has changed that is not clear from the diff of the test file itself.