Skip to content
Snippets Groups Projects
Unverified Commit f570c4ab authored by Nicolò Pretto's avatar Nicolò Pretto Committed by GitHub
Browse files

add withUndos option to renderWithProviders to render Undos during … (#41576)

parent 2072e060
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ import { routerReducer, routerMiddleware } from "react-router-redux";
import _ from "underscore";
import { Api } from "metabase/api";
import { UndoListing } from "metabase/containers/UndoListing";
import mainReducers from "metabase/reducers-main";
import publicReducers from "metabase/reducers-public";
import { ThemeProvider } from "metabase/ui";
......@@ -32,6 +33,7 @@ export interface RenderWithProvidersOptions {
storeInitialState?: Partial<State>;
withRouter?: boolean;
withDND?: boolean;
withUndos?: boolean;
customReducers?: ReducerObject;
}
......@@ -48,6 +50,7 @@ export function renderWithProviders(
storeInitialState = {},
withRouter = false,
withDND = false,
withUndos = false,
customReducers,
...options
}: RenderWithProvidersOptions = {},
......@@ -95,6 +98,7 @@ export function renderWithProviders(
history={history}
withRouter={withRouter}
withDND={withDND}
withUndos={withUndos}
/>
);
......@@ -116,12 +120,14 @@ function Wrapper({
history,
withRouter,
withDND,
withUndos,
}: {
children: React.ReactElement;
store: any;
history?: History;
withRouter: boolean;
withDND: boolean;
withUndos?: boolean;
}): JSX.Element {
return (
<Provider store={store}>
......@@ -130,6 +136,7 @@ function Wrapper({
<MaybeRouter hasRouter={withRouter} history={history}>
{children}
</MaybeRouter>
{withUndos && <UndoListing />}
</ThemeProvider>
</MaybeDNDProvider>
</Provider>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment