Skip to content

Commit

Permalink
fix editing and creating modals not opening
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Jul 5, 2023
1 parent 57f4b79 commit dfc6790
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions apps/mantine-react-table-docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import Head from 'next/head';

### V1

#### V1.0.0-beta.24

- Fixed Edit and Create Row Modals not opening

#### V1.0.0-beta.23

- a bunch of create row features (still in progress)
Expand Down
2 changes: 1 addition & 1 deletion packages/mantine-react-table/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.23",
"version": "1.0.0-beta.24",
"license": "MIT",
"name": "mantine-react-table",
"description": "A fully featured Mantine implementation of TanStack React Table V8, written from the ground up in TypeScript.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const MRT_EditRowModal = <TData extends Record<string, any>>({
opened={open}
withCloseButton={false}
{...modalProps}
key={row.id}
>
{((creatingRow &&
renderCreateRowModalContent?.({
Expand Down
10 changes: 6 additions & 4 deletions packages/mantine-react-table/src/table/MRT_Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ export const MRT_Table = <TData extends Record<string, any>>({
virtualPaddingRight,
};

const createModalOpen = creatingMode === 'modal' && creatingRow;
const editModalOpen = editingMode === 'modal' && editingRow;

return (
<>
<Table
Expand Down Expand Up @@ -186,10 +189,9 @@ export const MRT_Table = <TData extends Record<string, any>>({
)}
{enableTableFooter && <MRT_TableFooter {...props} />}
</Table>
{(creatingRow && creatingMode === 'modal') ||
(editingRow && editingMode === 'modal' && (
<MRT_EditRowModal open table={table} />
))}
{(createModalOpen || editModalOpen) && (
<MRT_EditRowModal open table={table} />
)}
</>
);
};

2 comments on commit dfc6790

@vercel
Copy link

@vercel vercel bot commented on dfc6790 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on dfc6790 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.