Add namespacing for query params (#205)

* use qs utils to namespace query params

* refactor Lookup and SelectResource Steps to use PaginatedDataList

* preserve query params when adding new ones

* require namespace for QS Configs
This commit is contained in:
Keith Grant
2019-05-15 10:06:14 -04:00
committed by GitHub
parent d59975c1ad
commit 4407aeac20
19 changed files with 2656 additions and 2648 deletions

View File

@@ -79,30 +79,31 @@ const defaultContexts = {
dialog: {}
};
const providers = {
config: ConfigProvider,
network: _NetworkProvider,
dialog: RootDialogProvider,
};
function wrapContexts (node, context) {
let wrapped = node;
let isFirst = true;
Object.keys(providers).forEach(key => {
if (context[key]) {
const Provider = providers[key];
wrapped = (
<Provider
value={context[key]}
i18n={isFirst ? defaultContexts.linguiPublisher.i18n : null}
>
{wrapped}
</Provider>
const { config, network, dialog } = context;
class Wrap extends React.Component {
render () {
// eslint-disable-next-line react/no-this-in-sfc
const { children, ...props } = this.props;
const component = React.cloneElement(children, props);
return (
<RootDialogProvider value={dialog}>
<_NetworkProvider value={network}>
<ConfigProvider
value={config}
i18n={defaultContexts.linguiPublisher.i18n}
>
{component}
</ConfigProvider>
</_NetworkProvider>
</RootDialogProvider>
);
isFirst = false;
}
});
return wrapped;
}
return (
<Wrap>{node}</Wrap>
);
}
function applyDefaultContexts (context) {