mirror of
https://github.com/inventree/InvenTree.git
synced 2025-11-13 11:26:42 +00:00
Fixes #10701
The issue was that the table row key was using 'props.item.pk', but the
API returns 'id' instead. This caused React to not properly render the
rows with their values.
Changed the key to use 'props.item.id' with a fallback to 'props.idx'
for new rows that don't have an ID yet.
(cherry picked from commit 8d1f7f39b4)
Signed-off-by: Akhil Singh <singhakhil69@gmail.com>
Co-authored-by: Akhil Singh <35478226+akhilsingh-git@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
02fc02ffd1
commit
0d305e10f6
@@ -1,11 +1,9 @@
|
|||||||
|
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { Table } from '@mantine/core';
|
import { Table } from '@mantine/core';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
||||||
import { StandaloneField } from '../components/forms/StandaloneField';
|
import { StandaloneField } from '../components/forms/StandaloneField';
|
||||||
|
|
||||||
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
|
||||||
import type { TableFieldRowProps } from '../components/forms/fields/TableField';
|
import type { TableFieldRowProps } from '../components/forms/fields/TableField';
|
||||||
|
|
||||||
function BuildAllocateLineRow({
|
function BuildAllocateLineRow({
|
||||||
@@ -62,7 +60,7 @@ function BuildAllocateLineRow({
|
|||||||
}, [props]);
|
}, [props]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table.Tr key={`table-row-${props.item.pk}`}>
|
<Table.Tr key={`table-row-${props.item.id ?? props.idx}`}>
|
||||||
<Table.Td>
|
<Table.Td>
|
||||||
<StandaloneField fieldName='value' fieldDefinition={valueField} />
|
<StandaloneField fieldName='value' fieldDefinition={valueField} />
|
||||||
</Table.Td>
|
</Table.Td>
|
||||||
|
|||||||
Reference in New Issue
Block a user