Skip to content

Commit

Permalink
fix: minor misses in merging and items is type array
Browse files Browse the repository at this point in the history
  • Loading branch information
awesthouse authored and KristianKjerstad committed Jun 28, 2023
1 parent 5446bac commit 2bde93b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export const GenericListPlugin = (
entity: { type: type },
})
.then((newEntity: AxiosResponse<object, TGenericObject>) => {
console.log('created', newEntity)
setItems([
...items,
{
Expand Down
4 changes: 2 additions & 2 deletions packages/dm-core-plugins/src/table/TablePlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const TablePlugin = (props: IUIPlugin) => {
{
key: crypto.randomUUID(),
data: newEntity.data,
index: Object.keys(items).length,
index: items?.length,
expanded: false,
isSaved: false,
},
Expand Down Expand Up @@ -247,7 +247,7 @@ export const TablePlugin = (props: IUIPlugin) => {
color="danger"
variant="ghost_icon"
onClick={() =>
deleteItem(`${idReference}.${index}`, item.key)
deleteItem(`${idReference}[${index}]`, item.key)
}
>
<Icon data={delete_to_trash} aria-hidden />
Expand Down
4 changes: 2 additions & 2 deletions packages/dm-core-plugins/src/table/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TViewConfig } from '@development-framework/dm-core'
import { TGenericObject, TViewConfig } from '@development-framework/dm-core'

export type TTablePluginConfig = {
editMode: boolean
Expand Down Expand Up @@ -36,7 +36,7 @@ export const defaultConfig: TTablePluginConfig = {

export type TTableItemRow = {
key: string
data: any
data: TGenericObject
index: number
expanded: boolean
isSaved: boolean
Expand Down

0 comments on commit 2bde93b

Please sign in to comment.