From 2b7ad714de07ff48c6a4f3bf3e40fff0ed25ea54 Mon Sep 17 00:00:00 2001 From: Rob Colburn Date: Tue, 6 Oct 2015 15:34:09 -0700 Subject: [PATCH] Clarify createLocation deprecation message. Observing new messages in your server log can be bewildering. You do not know where the text is coming from, and only `grep` can save you. Once you've found it, what does it mean? Perhaps, you've only copy/pasted reference code from some popular module's docs. Attempt to provide context as to what is complaining, and why it's complaining. --- docs/Location.md | 2 ++ modules/createLocation.js | 2 +- modules/deprecate.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Location.md b/docs/Location.md index 1d5d2e2ab..046a6f5e1 100644 --- a/docs/Location.md +++ b/docs/Location.md @@ -17,5 +17,7 @@ Support for query string parsing is provided using the [`useQueries` module](Que You may occasionally need to create a `location` object, either for testing or when using `history` in a stateless environment (like a server). `history` objects have a `createLocation` method for this purpose. ```js +import { createHistory } from 'history' +let history = createHistory() let location = history.createLocation('/a/path?a=query', { the: 'state' }) ``` diff --git a/modules/createLocation.js b/modules/createLocation.js index af82e5827..89fbc1388 100644 --- a/modules/createLocation.js +++ b/modules/createLocation.js @@ -51,5 +51,5 @@ function createLocation(path='/', state=null, action=POP, key=null) { export default deprecate( createLocation, - 'createLocation is deprecated; use history.createLocation instead' + 'Calling createLocation statically is deprecated; instead call the history.createLocation method - see docs/Location.md' ) diff --git a/modules/deprecate.js b/modules/deprecate.js index 9a9891c52..f8fbfda18 100644 --- a/modules/deprecate.js +++ b/modules/deprecate.js @@ -2,7 +2,7 @@ import warning from 'warning' function deprecate(fn, message) { return function () { - warning(false, message) + warning(false, '[history] ' + message) return fn.apply(this, arguments) } }