Skip to content

Commit

Permalink
fix(react-ui-lib): fix re-rendering of datagrid columns
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Jul 2, 2024
1 parent 423e7ff commit 6e82193
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 6e82193

Please sign in to comment.