diff --git a/flow-typed/npm/query-string_v6.x.x.js b/flow-typed/npm/query-string_v6.x.x.js deleted file mode 100644 index 837d96d34c..0000000000 --- a/flow-typed/npm/query-string_v6.x.x.js +++ /dev/null @@ -1,42 +0,0 @@ -// flow-typed signature: 4a4ede4f7f12b874598b0b727b9a1c4c -// flow-typed version: f898dad1b0/query-string_v6.x.x/flow_>=v0.104.x - -declare module 'query-string' { - declare type ArrayFormat = 'none' | 'bracket' | 'index' | 'comma' - declare type ParseOptions = {| - arrayFormat?: ArrayFormat, - decode?: boolean, - sort?: false | (A, B) => number, - parseNumbers?: boolean, - parseBooleans?: boolean, - |} - - declare type StringifyOptions = {| - arrayFormat?: ArrayFormat, - encode?: boolean, - strict?: boolean, - sort?: false | (A, B) => number, - skipNull?: boolean, - |} - - declare type ObjectParameter = string | number | boolean | null | void; - - declare type ObjectParameters = $ReadOnly<{ [string]: ObjectParameter | $ReadOnlyArray, ... }> - - declare type QueryParameters = { [string]: string | Array | null, ... } - - declare type StringifyObjectParameter = {| url: string, query?: QueryParameters |} - - declare module.exports: { - extract(str: string): string, - parse(str: string, opts?: ParseOptions): QueryParameters, - parseUrl(str: string, opts?: ParseOptions): { - url: string, - query: QueryParameters, - ... - }, - stringify(obj: ObjectParameters, opts?: StringifyOptions): string, - stringifyUrl(obj: StringifyObjectParameter, opts?: StringifyOptions): string, - ... - } -} diff --git a/flow-typed/npm/query-string_v9.x.x.js b/flow-typed/npm/query-string_v9.x.x.js new file mode 100644 index 0000000000..c242d25b12 --- /dev/null +++ b/flow-typed/npm/query-string_v9.x.x.js @@ -0,0 +1,23 @@ +// flow-typed signature: ec1d99909d639f153164cf55049d63b2 +// flow-typed version: <>/query-string_v^9.1.1/flow_v0.132.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'query-string' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'query-string' { + declare type QueryParameters = { [string]: string | Array | null, ... } + + declare module.exports: { + parse(str: string, opts?: any): QueryParameters, + ... + } +} diff --git a/src/core_modules/capture-core/components/App/withAppUrlSync.js b/src/core_modules/capture-core/components/App/withAppUrlSync.js index 4f6980e195..9bb3b83e9d 100644 --- a/src/core_modules/capture-core/components/App/withAppUrlSync.js +++ b/src/core_modules/capture-core/components/App/withAppUrlSync.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; import { connect } from 'react-redux'; -import { parse, type QueryParameters } from 'query-string'; +import queryString, { type QueryParameters } from 'query-string'; import { paramsSelector } from './appSync.selectors'; import { LoadingMaskForPage } from '../LoadingMasks'; import { viewEventFromUrl } from '../Pages/ViewEvent/ViewEventComponent/viewEvent.actions'; @@ -81,7 +81,7 @@ export const withAppUrlSync = () => (InnerComponent: React.ComponentType) = setPageAndParams() { const { location } = this.props; this.page = location.pathname.substring(1); - this.params = parse(location && location.search); + this.params = queryString.parse(location && location.search); } render() { diff --git a/src/core_modules/capture-core/components/UrlSync/withUrlSync.js b/src/core_modules/capture-core/components/UrlSync/withUrlSync.js index c452f2a92c..ecb9ed1599 100644 --- a/src/core_modules/capture-core/components/UrlSync/withUrlSync.js +++ b/src/core_modules/capture-core/components/UrlSync/withUrlSync.js @@ -3,7 +3,7 @@ * @namespace UrlSync */ import * as React from 'react'; -import { parse, type QueryParameters } from 'query-string'; +import queryString, { type QueryParameters } from 'query-string'; import { pageFetchesOrgUnitUsingTheOldWay } from '../../utils/url'; type Props = { @@ -96,7 +96,7 @@ const getUrlSyncer = ( isOutOfSync() { const syncSpecification = onGetSyncSpecification(this.props); const { history: { location }, statePage, urlPage } = this.props; - const locationParams = parse(location && location.search); + const locationParams = queryString.parse(location && location.search); const urlParamsAreOutOfSync = this.paramsNeedsUpdate(syncSpecification, locationParams); const urlPathnameIsOutOfSync = urlPage !== statePage;