Skip to content

Commit

Permalink
Fix another "Rendered more hooks than during the previous render"
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolemos committed Jul 4, 2019
1 parent 6373349 commit 70bbfd5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/components/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ export const Sidebar = React.memo((props: SidebarProps) => {

Sidebar.displayName = 'Sidebar'

const getFilteredItemsOptions: Parameters<typeof getFilteredItems>[3] = {
mergeSimilar: false,
}

const SidebarColumnItem = React.memo(
(props: {
activeOpacity?: ColumnHeaderItemProps['activeOpacity']
Expand Down Expand Up @@ -607,13 +611,12 @@ const SidebarColumnItem = React.memo(

const { column, columnIndex, headerDetails } = useColumn(columnId)

if (!(column && columnIndex >= 0 && headerDetails)) return null

const getFilteredItemsOptions: Parameters<typeof getFilteredItems>[3] = {
mergeSimilar: false,
}
const { allItems } = useColumnData(
(column && column.id) || '',
getFilteredItemsOptions,
)

const { allItems } = useColumnData(column.id, getFilteredItemsOptions)
if (!(column && columnIndex >= 0 && headerDetails)) return null

const filteredItemsMetadata = getItemsFilterMetadata(
column.type,
Expand Down

0 comments on commit 70bbfd5

Please sign in to comment.