Skip to content

Commit

Permalink
Merge pull request #740 from contember/fix/datagrid-col-rerender
Browse files Browse the repository at this point in the history
fix(react-ui-lib): fix re-rendering of datagrid columns
  • Loading branch information
matej21 committed Jul 2, 2024
2 parents 26d5d96 + 41930c7 commit 1558c65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-ui-lib/src/datagrid/table.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Environment } from '@contember/interface'
import { Table, TableBody, TableHeader, TableRow } from '../ui/table'
import * as React from 'react'
import { Fragment, ReactNode, useState } from 'react'
import { Fragment, ReactNode, useMemo } from 'react'
import { DataViewEachRow, DataViewLayout } from '@contember/react-dataview'
import { SheetIcon } from 'lucide-react'
import { dict } from '../dict'
Expand All @@ -28,7 +28,7 @@ export const DataGridTable = Component<DataViewTableProps>(({ children }) => {
})

const DataGridTableRenderer = Component< DataViewTableProps>(({ children }, env) => {
const [columns] = useState(() => datagridColumnsAnalyzer.processChildren(children, env))
const columns = useMemo(() => datagridColumnsAnalyzer.processChildren(children, env), [children, env])
return (
<Table>
<TableHeader>
Expand Down

0 comments on commit 1558c65

Please sign in to comment.