From f15d4775d5c366a7f799653a3e6e820f5b84252b Mon Sep 17 00:00:00 2001 From: Tom Robinson <tlrobinson@gmail.com> Date: Wed, 6 Jun 2018 15:40:55 -0700 Subject: [PATCH] Fix collection_id (except for root, pending endpoint fix) --- .../src/metabase/components/CollectionLanding.jsx | 11 ++++++++--- .../metabase/entities/containers/EntityListLoader.jsx | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/metabase/components/CollectionLanding.jsx b/frontend/src/metabase/components/CollectionLanding.jsx index 91fd17974bc..5f19ab36eb8 100644 --- a/frontend/src/metabase/components/CollectionLanding.jsx +++ b/frontend/src/metabase/components/CollectionLanding.jsx @@ -22,7 +22,7 @@ import CollectionEmptyState from "metabase/components/CollectionEmptyState"; import EntityMenu from "metabase/components/EntityMenu"; import CollectionListLoader from "metabase/containers/CollectionListLoader"; -import CollectionLoader from "metabase/containers/CollectionItemsLoader"; +import CollectionLoader from "metabase/containers/CollectionLoader"; import { entityListLoader } from "metabase/entities/containers/EntityListLoader"; import Collections from "metabase/entities/collections"; @@ -86,7 +86,12 @@ const CollectionList = () => { ); }; -@connect((state, { collectionId }) => ({ entityQuery: { collectionId } })) +@connect((state, { collectionId }) => ({ + entityQuery: + collectionId === "root" + ? {} // FIXME /api/search doesn't yet support root collection + : { collection_id: collectionId }, +})) @entityListLoader({ entityType: "search", wrapped: true, @@ -116,7 +121,7 @@ class DefaultLanding extends React.Component { <Box w={2 / 3}> <Box> <CollectionLoader collectionId={collectionId || "root"}> - {({ collection }) => { + {({ object: collection }) => { if (list.length === 0) { return <CollectionEmptyState />; } diff --git a/frontend/src/metabase/entities/containers/EntityListLoader.jsx b/frontend/src/metabase/entities/containers/EntityListLoader.jsx index 17f7ed12280..94bf9c16067 100644 --- a/frontend/src/metabase/entities/containers/EntityListLoader.jsx +++ b/frontend/src/metabase/entities/containers/EntityListLoader.jsx @@ -107,7 +107,7 @@ export const entityListLoader = (ellProps: Props) => (ComposedComponent: any) => // eslint-disable-next-line react/display-name (props: Props) => ( - <EntityListLoader {...ellProps}> + <EntityListLoader {...props} {...ellProps}> {childProps => <ComposedComponent {...props} {...childProps} />} </EntityListLoader> ); -- GitLab