diff --git a/flow-typed/qs.js b/flow-typed/qs.js deleted file mode 100644 index eb06ded2..00000000 --- a/flow-typed/qs.js +++ /dev/null @@ -1,5 +0,0 @@ -declare module 'qs' { - declare module.exports: { - parse: (str: string, opts: Object) => Object, - }; -} diff --git a/package.json b/package.json index 9752705e..dbb60bb2 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "glamor": "^2.20.40", "hex2rgba": "^0.0.1", "prettier": "^1.7.4", - "qs": "^6.5.1", "remarkable": "^1.7.1", "request-promise": "^4.2.2", "rimraf": "^2.6.1", diff --git a/src/components/ErrorDecoder/ErrorDecoder.js b/src/components/ErrorDecoder/ErrorDecoder.js index a53cfbe9..51f2d8c3 100644 --- a/src/components/ErrorDecoder/ErrorDecoder.js +++ b/src/components/ErrorDecoder/ErrorDecoder.js @@ -8,7 +8,6 @@ 'use strict'; import React from 'react'; -import qs from 'qs'; import type {Node} from 'react'; @@ -44,14 +43,25 @@ function urlify(str: string): Node { function parseQueryString( search: string, ): ?{|code: string, args: Array|} { - const qsResult = qs.parse(search, {ignoreQueryPrefix: true}); - if (!qsResult.invariant) { + const rawQueryString = search.substring(1); + if (!rawQueryString) { return null; } - return { - code: qsResult.invariant, - args: qsResult.args || [], - }; + + let code = ''; + let args = []; + + const queries = rawQueryString.split('&'); + for (let i = 0; i < queries.length; i++) { + const query = decodeURIComponent(queries[i]); + if (query.indexOf('invariant=') === 0) { + code = query.slice(10); + } else if (query.indexOf('args[') === 0) { + args.push(query.slice(query.indexOf(']=') + 2)); + } + } + + return {args, code}; } function ErrorResult(props: {|code: ?string, msg: string|}) { diff --git a/yarn.lock b/yarn.lock index 15973cef..826da445 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7688,10 +7688,6 @@ qs@6.4.0, qs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" -qs@^6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - query-string@^4.1.0: version "4.3.4" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb"