Skip to content

Commit

Permalink
Merge pull request #174 from taion/hash-history-push-warning
Browse files Browse the repository at this point in the history
Add back warning for state without queryKey
  • Loading branch information
mjackson committed Dec 7, 2015
2 parents 83f1a63 + f2ed77c commit 22ca0fb
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions modules/createHashHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,24 @@ function createHashHistory(options={}) {
}
}

function push(location) {
warning(
queryKey || location.state == null,
'You cannot use state without a queryKey it will be dropped'
)

history.push(location)
}

function replace(location) {
warning(
queryKey || location.state == null,
'You cannot use state without a queryKey it will be dropped'
)

history.replace(location)
}

let goIsSupportedWithoutReload = supportsGoWithoutReloadUsingHash()

function go(n) {
Expand Down Expand Up @@ -187,7 +205,7 @@ function createHashHistory(options={}) {
stopHashChangeListener()
}

// deprecated - warning is in createHistory
// deprecated
function pushState(state, path) {
warning(
queryKey || state == null,
Expand All @@ -197,7 +215,7 @@ function createHashHistory(options={}) {
history.pushState(state, path)
}

// deprecated - warning is in createHistory
// deprecated
function replaceState(state, path) {
warning(
queryKey || state == null,
Expand All @@ -211,12 +229,15 @@ function createHashHistory(options={}) {
...history,
listenBefore,
listen,
pushState,
replaceState,
push,
replace,
go,
createHref,
registerTransitionHook,
unregisterTransitionHook

registerTransitionHook, // deprecated - warning is in createHistory
unregisterTransitionHook, // deprecated - warning is in createHistory
pushState, // deprecated - warning is in createHistory
replaceState // deprecated - warning is in createHistory
}
}

Expand Down

0 comments on commit 22ca0fb

Please sign in to comment.