Skip to content

Commit 08a0eb5

Browse files
committed
🐛(frontend) fix crash share modal on grid options
The share modal in the DocsGridItem component was crashing when opened due to a provider not initialized.
1 parent 0afc50f commit 08a0eb5

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to
1313
- 🌐(frontend) keep simple tag during export #1154
1414
- 🐛(back) manage can-edit endpoint without created room in the ws
1515
- 🐛(frontend) fix action buttons not clickable #1162
16+
- 🐛(frontend) fix crash share modal on grid options #1174
1617

1718
## [3.4.0] - 2025-07-09
1819

src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ test.describe('Document grid item options', () => {
9191
await page.goto('/');
9292
});
9393

94+
test('it checks the share modal', async ({ page, browserName }) => {
95+
const [docTitle] = await createDoc(page, `check share modal`, browserName);
96+
97+
await page.goto('/');
98+
99+
await expect(page.getByText(docTitle)).toBeVisible();
100+
const row = await getGridRow(page, docTitle);
101+
await row.getByText(`more_horiz`).click();
102+
103+
await page.getByRole('menuitem', { name: 'Share' }).click();
104+
105+
await expect(
106+
page.getByRole('dialog').getByText('Share the document'),
107+
).toBeVisible();
108+
});
109+
94110
test('it pins a document', async ({ page, browserName }) => {
95111
const [docTitle] = await createDoc(page, `Favorite doc`, browserName);
96112

src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { TreeProvider } from '@gouvfr-lasuite/ui-kit';
12
import { Tooltip, useModal } from '@openfun/cunningham-react';
23
import { DateTime } from 'luxon';
34
import { useTranslation } from 'react-i18next';
@@ -143,7 +144,9 @@ export const DocsGridItem = ({ doc, dragMode = false }: DocsGridItemProps) => {
143144
</Box>
144145
</Box>
145146
{shareModal.isOpen && (
146-
<DocShareModal doc={doc} onClose={shareModal.close} />
147+
<TreeProvider initialNodeId={doc.id}>
148+
<DocShareModal doc={doc} onClose={shareModal.close} />
149+
</TreeProvider>
147150
)}
148151
</>
149152
);

0 commit comments

Comments
 (0)