From 08a0eb59c8dbef259ddfa0e9c01c8abcdbe87846 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Tue, 15 Jul 2025 11:36:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20fix=20crash=20share=20?= =?UTF-8?q?modal=20on=20grid=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The share modal in the DocsGridItem component was crashing when opened due to a provider not initialized. --- CHANGELOG.md | 1 + .../e2e/__tests__/app-impress/doc-grid.spec.ts | 16 ++++++++++++++++ .../docs/docs-grid/components/DocsGridItem.tsx | 5 ++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c26b4ff9..92a34d62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to - 🌐(frontend) keep simple tag during export #1154 - 🐛(back) manage can-edit endpoint without created room in the ws - 🐛(frontend) fix action buttons not clickable #1162 +- 🐛(frontend) fix crash share modal on grid options #1174 ## [3.4.0] - 2025-07-09 diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts index fc3c522d..f0da725b 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts @@ -91,6 +91,22 @@ test.describe('Document grid item options', () => { await page.goto('/'); }); + test('it checks the share modal', async ({ page, browserName }) => { + const [docTitle] = await createDoc(page, `check share modal`, browserName); + + await page.goto('/'); + + await expect(page.getByText(docTitle)).toBeVisible(); + const row = await getGridRow(page, docTitle); + await row.getByText(`more_horiz`).click(); + + await page.getByRole('menuitem', { name: 'Share' }).click(); + + await expect( + page.getByRole('dialog').getByText('Share the document'), + ).toBeVisible(); + }); + test('it pins a document', async ({ page, browserName }) => { const [docTitle] = await createDoc(page, `Favorite doc`, browserName); diff --git a/src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx b/src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx index 58971dd5..eb3cfbc6 100644 --- a/src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx +++ b/src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx @@ -1,3 +1,4 @@ +import { TreeProvider } from '@gouvfr-lasuite/ui-kit'; import { Tooltip, useModal } from '@openfun/cunningham-react'; import { DateTime } from 'luxon'; import { useTranslation } from 'react-i18next'; @@ -143,7 +144,9 @@ export const DocsGridItem = ({ doc, dragMode = false }: DocsGridItemProps) => { {shareModal.isOpen && ( - + + + )} );