Skip to content

The open alternative to Salesforce, designed for AI.

Upgrade Preact to 11 for React 19 refs (#27271)

Raphaël Bosie0f4a62480ba
diff --git a/packages/twenty-docs/ui/components/input/country-select.mdx b/packages/twenty-docs/ui/components/input/country-select.mdx
index d1e2d44871e..4190141fb79 100644
--- a/packages/twenty-docs/ui/components/input/country-select.mdx
+++ b/packages/twenty-docs/ui/components/input/country-select.mdx
@@ -71,7 +71,7 @@ Keep application dropdown IDs, focus stacks, field metadata, persistence, and ed
## Front component renderer
-The React and Preact front component sandboxes render the selected country, decorative flag, and disabled trigger. In React the trigger opens the popup, but the popup renders into the sandbox document instead of the page, so its content is not visible. In Preact the popup does not open. Search, selection, popup focus, and closing are therefore unavailable in those sandboxes for now. Renderer fixtures check the initial presentation and the disabled trigger, then assert this opening behavior. The UI Storybook exercises these interactions in a regular browser.
+The React and Preact front component sandboxes render the selected country, decorative flag, and disabled trigger. In both sandboxes the trigger opens the popup, but the popup renders into the sandbox document instead of the page, so its content is not visible. Search, selection, popup focus, and closing from the popup are therefore unavailable in those sandboxes for now. Renderer fixtures check the initial presentation and the disabled trigger, then assert that the trigger opens the popup in both runtimes. The UI Storybook exercises these interactions in a regular browser.
## Props
diff --git a/packages/twenty-docs/ui/components/input/currency-picker.mdx b/packages/twenty-docs/ui/components/input/currency-picker.mdx
index da2ac688f54..db2a46cb98c 100644
--- a/packages/twenty-docs/ui/components/input/currency-picker.mdx
+++ b/packages/twenty-docs/ui/components/input/currency-picker.mdx
@@ -71,7 +71,7 @@ Native attributes, `className`, `style`, `ref`, and `render` apply to each part'
## Front-component renderer
-React and Preact sandbox fixtures verify code presentation and the disabled trigger. In React the trigger opens the popup, but the popup renders into the sandbox document instead of the page, so its content is not visible. In Preact the popup does not open. Search, currency selection, popup focus, and closing are not supported in that sandbox until these limitations are resolved. Ordinary React hosts exercise the complete interaction.
+React and Preact sandbox fixtures verify code presentation and the disabled trigger. In both runtimes the trigger opens the popup, but the popup renders into the sandbox document instead of the page, so its content is not visible. Search, currency selection, popup focus, and closing from the popup are not supported in that sandbox until these limitations are resolved. Ordinary React hosts exercise the complete interaction.
## Props
diff --git a/packages/twenty-docs/ui/components/input/phone-country-picker.mdx b/packages/twenty-docs/ui/components/input/phone-country-picker.mdx
index 9f7c084fe54..63d3e5ee0e7 100644
--- a/packages/twenty-docs/ui/components/input/phone-country-picker.mdx
+++ b/packages/twenty-docs/ui/components/input/phone-country-picker.mdx
@@ -79,7 +79,7 @@ Supply localized country labels in `countries` and an accessible name on `Trigge
## Front component renderer
-In [front components](/developers/extend/apps/layout/front-components), the React and Preact renderers display the trigger, its flag, and its disabled state. In React the trigger opens the popup, but the popup renders into the sandbox document instead of the page, so its search and options are not visible yet. In Preact the popup does not open. These limitations do not affect normal React rendering.
+In [front components](/developers/extend/apps/layout/front-components), the React and Preact renderers display the trigger, its flag, and its disabled state. In both renderers the trigger opens the popup, but the popup renders into the sandbox document instead of the page, so its search and options are not visible yet. These limitations do not affect normal React rendering.
## Props
diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiCountrySelect.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiCountrySelect.stories.tsx
index bf2db09f942..10fa55c82f9 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiCountrySelect.stories.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiCountrySelect.stories.tsx
@@ -5,7 +5,7 @@ import {
resetFrontComponentStoryMocks,
} from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
import { type TwentyUiGalleryStory as Story } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory';
-import { createCountrySelectTest } from '@/__stories__/twenty-ui-gallery/utils/createCountrySelectTest';
+import { countrySelectTest } from '@/__stories__/twenty-ui-gallery/utils/countrySelectTest';
import { createGalleryStory } from '@/__stories__/twenty-ui-gallery/utils/createGalleryStory';
import { FrontComponentRenderer } from '@/host/components/FrontComponentRenderer';
@@ -21,11 +21,11 @@ export default meta;
export const CountrySelectReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-country-select',
runtime: 'react',
- play: createCountrySelectTest('react'),
+ play: countrySelectTest,
});
export const CountrySelectPreact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-country-select',
runtime: 'preact',
- play: createCountrySelectTest('preact'),
+ play: countrySelectTest,
});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
index 7e91fec705f..71a01de7fca 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
@@ -1,6 +1,6 @@
-import { createCurrencyPickerTest } from '@/__stories__/twenty-ui-gallery/utils/createCurrencyPickerTest';
-import { createDropdownTest } from '@/__stories__/twenty-ui-gallery/utils/createDropdownTest';
-import { createPhoneCountryPickerTest } from '@/__stories__/twenty-ui-gallery/utils/createPhoneCountryPickerTest';
+import { currencyPickerTest } from '@/__stories__/twenty-ui-gallery/utils/currencyPickerTest';
+import { dropdownTest } from '@/__stories__/twenty-ui-gallery/utils/dropdownTest';
+import { phoneCountryPickerTest } from '@/__stories__/twenty-ui-gallery/utils/phoneCountryPickerTest';
import { phoneCountryPickerTriggerTest } from '@/__stories__/twenty-ui-gallery/utils/phoneCountryPickerTriggerTest';
import { breadcrumbTest } from '@/__stories__/twenty-ui-gallery/utils/breadcrumbTest';
import { imageInputTest } from '@/__stories__/twenty-ui-gallery/utils/imageInputTest';
@@ -16,7 +16,7 @@ import { numberStepperTest } from '@/__stories__/twenty-ui-gallery/utils/numberS
import { numberStepperSandboxFailureTest } from '@/__stories__/twenty-ui-gallery/utils/numberStepperSandboxFailureTest';
import { settingsRowTest } from '@/__stories__/twenty-ui-gallery/utils/settingsRowTest';
import { resizeHandleTest } from '@/__stories__/twenty-ui-gallery/utils/resizeHandleTest';
-import { createListItemSandboxFailureTest } from '@/__stories__/twenty-ui-gallery/utils/createListItemSandboxFailureTest';
+import { listItemTest } from '@/__stories__/twenty-ui-gallery/utils/listItemTest';
import { pickerListItemsTest } from '@/__stories__/twenty-ui-gallery/utils/pickerListItemsTest';
import { iconButtonElevatedTest } from '@/__stories__/twenty-ui-gallery/utils/iconButtonElevatedTest';
import { buttonControlsTest } from '@/__stories__/twenty-ui-gallery/utils/buttonControlsTest';
@@ -278,12 +278,12 @@ export const BreadcrumbPreact: Story = createGalleryStory({
export const ListItemReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-list-item',
runtime: 'react',
- play: createListItemSandboxFailureTest('react'),
+ play: listItemTest,
});
export const ListItemPreact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-list-item',
runtime: 'preact',
- play: createListItemSandboxFailureTest('preact'),
+ play: listItemTest,
});
export const PickerListItemsReact: Story = createGalleryStory({
@@ -358,13 +358,13 @@ export const MenuPreact: Story = createGalleryStory({
export const DropdownReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-dropdown',
runtime: 'react',
- play: createDropdownTest('react'),
+ play: dropdownTest,
});
export const DropdownPreact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-dropdown',
runtime: 'preact',
- play: createDropdownTest('preact'),
+ play: dropdownTest,
});
export const PhoneCountryPickerTriggersReact: Story = createGalleryStory({
@@ -382,13 +382,13 @@ export const PhoneCountryPickerTriggersPreact: Story = createGalleryStory({
export const PhoneCountryPickerReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-phone-country-picker',
runtime: 'react',
- play: createPhoneCountryPickerTest('react'),
+ play: phoneCountryPickerTest,
});
export const PhoneCountryPickerPreact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-phone-country-picker',
runtime: 'preact',
- play: createPhoneCountryPickerTest('preact'),
+ play: phoneCountryPickerTest,
});
export const SelectReact: Story = createGalleryStory({
@@ -674,11 +674,11 @@ export const ImageInputPreact: Story = createGalleryStory({
export const CurrencyPickerReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-currency-picker',
runtime: 'react',
- play: createCurrencyPickerTest('react'),
+ play: currencyPickerTest,
});
export const CurrencyPickerPreact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-currency-picker',
runtime: 'preact',
- play: createCurrencyPickerTest('preact'),
+ play: currencyPickerTest,
});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
index c543f7ef215..70670bac266 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
@@ -3,6 +3,9 @@
`TwentyUiGallery.stories.tsx` contains the component catalogs and focused
component stories. Each fixture has React and Preact stories built with
`createGalleryStory`, with an explicit bundle name, runtime, and play function.
+Preact stories need Preact 11, which passes `ref` to function components as a
+regular prop like React 19. Preact 10 hands that ref to the component instance,
+so Dropdown-based popups never open there.
Scenarios share their checks between runtimes where behavior matches. The story
file contains the metadata and named entries; `utils/` holds the story factory,
shared assertions, render checks, interaction checks, and known-failure
@@ -12,7 +15,7 @@ require.
`createGalleryRenderTest` checks the exact set of expected failed components.
`createOverlayOpenTest` checks that a trigger opens its overlay and pins the
popup content as absent from the page. `createDropdownOpenTest` applies it to
-the Dropdown-based popups in React and pins that they never open in Preact.
+the Dropdown-based popups.
`expectSandboxErrors` requires each listed known error and rejects any other
error. `expectAssertionToKeepFailing` pins an interaction that must have no
effect within the interaction timeout.
@@ -74,15 +77,13 @@ must change the corresponding story to assert successful behavior; do not keep
or broaden an obsolete expectation. No stories are skipped or marked as
expected-to-fail by the runner.
-| Component | Current limitation |
-| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| NumberStepper | Pointer stepping fails because the worker input does not implement `setSelectionRange`. Pasting is not covered: without `selectionStart`/`selectionEnd`, Base UI inserts the pasted text around the whole value and reports that number, then its caret restore throws from a layout effect, which unmounts the React tree and stops Preact rendering. Separate React and Preact stories assert the pointer gap and successful typing, keyboard bounds, disabled/read-only state, named form values and submission. |
-| ImageInput | Native file picker activation and usable file contents are unavailable in the sandbox. The fixture checks forwarded file metadata, preview recovery, action callbacks, and supplied error changes. See the [ImageInput documentation](../../../../twenty-docs/ui/components/input/image-input.mdx). |
-| Popover, Dialog, AlertDialog, Menu, Select, Dropdown, CurrencyPicker, PhoneCountryPicker, CountrySelect (React) | The trigger opens the overlay, but the popup portals into the sandbox `document.body`, which never reaches the host, so its content stays invisible. Search, selection, dismissal and focus restoration are not covered yet. |
-| Dropdown, CurrencyPicker, PhoneCountryPicker, CountrySelect (Preact) | The Dropdown-based popups never open. `Popover.Popup` is a plain function component, so Preact hands its ref to the component instance instead of the popup element, and the content reads `dataset` from that instance as soon as it mounts. The error is thrown inside Preact's render queue, so it never reaches the host and Preact stops re-rendering. |
-| ListItem | `ListItemPreact` handles selection, the disabled item and the submenu row, but the overflow tooltip's Floating UI `contains(parent, child)` check receives a parent without `contains` and throws. |
-| Slider | Thumbs stay hidden because the sandbox has no `ResizeObserver` to re-measure after the first geometry batch. |
-| Responsive hooks | The sandbox `window.matchMedia` answers for the widget's own box, so `useIsMobile` follows the widget width rather than the browser viewport: a widget 768px wide or narrower gets the mobile layout, and Button drops its hotkey hint, on any screen. `useIsTouchDevice` follows the primary input of the host device, so it is `false` under the desktop Chromium that runs these stories. The fixture asserts both at a 1024px and a 400px widget width. |
+| Component | Current limitation |
+| --- | --- |
+| NumberStepper | Pointer stepping fails because the worker input does not implement `setSelectionRange`. Pasting is not covered: without `selectionStart`/`selectionEnd`, Base UI inserts the pasted text around the whole value and reports that number, then its caret restore throws from a layout effect, which unmounts the React tree. Separate React and Preact stories assert the pointer gap and successful typing, keyboard bounds, disabled/read-only state, named form values and submission. |
+| ImageInput | Native file picker activation and usable file contents are unavailable in the sandbox. The fixture checks forwarded file metadata, preview recovery, action callbacks, and supplied error changes. See the [ImageInput documentation](../../../../twenty-docs/ui/components/input/image-input.mdx). |
+| Popover, Dialog, AlertDialog, Menu, Select, Dropdown, CurrencyPicker, PhoneCountryPicker, CountrySelect (React and Preact) | The trigger opens the overlay, but the popup portals into the sandbox `document.body`, which never reaches the host, so its content stays invisible. Search, selection, dismissal and focus restoration are not covered yet. |
+| Slider | Thumbs stay hidden because the sandbox has no `ResizeObserver` to re-measure after the first geometry batch. |
+| Responsive hooks | The sandbox `window.matchMedia` answers for the widget's own box, so `useIsMobile` follows the widget width rather than the browser viewport: a widget 768px wide or narrower gets the mobile layout, and Button drops its hotkey hint, on any screen. `useIsTouchDevice` follows the primary input of the host device, so it is `false` under the desktop Chromium that runs these stories. The fixture asserts both at a 1024px and a 400px widget width. |
The worker DOM now provides `Node.contains`, `compareDocumentPosition`,
`getRootNode`, `Element.matches`, `closest`, `querySelector` backed by
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsx
index 09cdf533660..3b42388668d 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsx
@@ -1,9 +1,13 @@
import { createElement, useState } from 'react';
import { defineFrontComponent } from 'twenty-sdk/define';
import { ListItem } from 'twenty-ui/primitives/navigation';
+import { Text } from 'twenty-ui/primitives/typography';
+import { ThemeProvider } from 'twenty-ui/theme';
import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';
+const OVERFLOW_ROW_STYLE = { width: 160 };
+
const ListItemExample = () => {
const [selected, setSelected] = useState(false);
const [opened, setOpened] = useState(false);
@@ -27,11 +31,21 @@ const ListItemExample = () => {
}
hasSubmenu
onClick={() => setOpened(true)}
+ onKeyDown={(event) => {
+ if (event.key === 'Escape') {
+ setOpened(false);
+ }
+ }}
>
Hidden fields
</ListItem>
- <p>Fields: {opened ? 'open' : 'closed'}</p>
- <p role="status">Digest: {selected ? 'enabled' : 'disabled'}</p>
+ <ThemeProvider colorScheme="light" applyToRoot={false}>
+ <ListItem style={OVERFLOW_ROW_STYLE}>
+ A long workspace preference that overflows its row
+ </ListItem>
+ </ThemeProvider>
+ <Text>Fields: {opened ? 'open' : 'closed'}</Text>
+ <Text role="status">Digest: {selected ? 'enabled' : 'disabled'}</Text>
</TwentyUiGalleryCard>
);
};
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createCountrySelectTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/countrySelectTest.ts
similarity index 75%
rename from packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createCountrySelectTest.ts
rename to packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/countrySelectTest.ts
index a3a073c4878..3d93a709144 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createCountrySelectTest.ts
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/countrySelectTest.ts
@@ -49,22 +49,19 @@ const expectDisabledTriggerIgnoresClick = async (canvas: Canvas) => {
).toHaveTextContent('Billing: France; Shipping: Japan');
};
-export const createCountrySelectTest = (
- runtime: 'react' | 'preact',
-): TwentyUiGalleryPlayFunction => {
- const billingCountrySelectOpenTest = createDropdownOpenTest({
- runtime,
- triggerName: BILLING_COUNTRY_TRIGGER_NAME,
- popupText: 'Brésil',
- });
+const billingCountrySelectOpenTest = createDropdownOpenTest({
+ triggerName: BILLING_COUNTRY_TRIGGER_NAME,
+ popupText: 'Brésil',
+});
- return async (context) => {
- const canvas = within(context.canvasElement);
- await expectFrontComponentMounted(canvas);
+export const countrySelectTest: TwentyUiGalleryPlayFunction = async (
+ context,
+) => {
+ const canvas = within(context.canvasElement);
+ await expectFrontComponentMounted(canvas);
- expectTriggersShowSavedCountriesWithDecorativeFlags(canvas);
- await expectDisabledTriggerIgnoresClick(canvas);
- expect(errorHandler).not.toHaveBeenCalled();
- await billingCountrySelectOpenTest(context);
- };
+ expectTriggersShowSavedCountriesWithDecorativeFlags(canvas);
+ await expectDisabledTriggerIgnoresClick(canvas);
+ expect(errorHandler).not.toHaveBeenCalled();
+ await billingCountrySelectOpenTest(context);
};
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createCurrencyPickerTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createCurrencyPickerTest.ts
deleted file mode 100644
index 3d4b0aca54f..00000000000
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createCurrencyPickerTest.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { expect, userEvent, within } from 'storybook/test';
-
-import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
-import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
-import { createDropdownOpenTest } from '@/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest';
-
-const PRIMARY_CURRENCY_TRIGGER_NAME = 'Primary currency';
-
-export const createCurrencyPickerTest = (
- runtime: 'react' | 'preact',
-): TwentyUiGalleryPlayFunction => {
- const primaryCurrencyPickerOpenTest = createDropdownOpenTest({
- runtime,
- triggerName: PRIMARY_CURRENCY_TRIGGER_NAME,
- popupText: 'Canadian Dollar',
- });
-
- return async (context) => {
- const canvas = within(context.canvasElement);
- const page = within(context.canvasElement.ownerDocument.body);
- await expectFrontComponentMounted(canvas);
-
- const primaryTrigger = canvas.getByRole('button', {
- name: PRIMARY_CURRENCY_TRIGGER_NAME,
- });
- const secondaryTrigger = canvas.getByRole('button', {
- name: 'Secondary currency',
- });
- const disabledTrigger = canvas.getByRole('button', {
- name: 'Disabled currency',
- });
-
- expect(primaryTrigger).toHaveTextContent('EUR');
- expect(secondaryTrigger).toHaveTextContent('USD');
- expect(disabledTrigger).toBeDisabled();
- await userEvent.click(disabledTrigger);
-
- await primaryCurrencyPickerOpenTest(context);
-
- expect(disabledTrigger).toHaveAttribute('aria-expanded', 'false');
- expect(
- page.queryByRole('dialog', { name: 'Disabled currencies' }),
- ).toBeNull();
- };
-};
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest.ts
index 703f66b2bcf..3242b8fef89 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest.ts
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest.ts
@@ -1,22 +1,15 @@
import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
-import { createDropdownPreactSandboxFailureTest } from '@/__stories__/twenty-ui-gallery/utils/createDropdownPreactSandboxFailureTest';
import { createOverlayOpenTest } from '@/__stories__/twenty-ui-gallery/utils/createOverlayOpenTest';
type CreateDropdownOpenTestOptions = {
- runtime: 'react' | 'preact';
triggerName: string;
popupText: string;
};
export const createDropdownOpenTest = ({
- runtime,
triggerName,
popupText,
}: CreateDropdownOpenTestOptions): TwentyUiGalleryPlayFunction => {
- if (runtime === 'preact') {
- return createDropdownPreactSandboxFailureTest({ triggerName });
- }
-
return createOverlayOpenTest({
trigger: { role: 'button', name: triggerName },
popupText,
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownPreactSandboxFailureTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownPreactSandboxFailureTest.ts
deleted file mode 100644
index e8b1b6c5f31..00000000000
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownPreactSandboxFailureTest.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { expect, userEvent, within } from 'storybook/test';
-
-import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
-import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
-import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
-import { expectAssertionToKeepFailing } from '@/__stories__/twenty-ui-gallery/utils/expectAssertionToKeepFailing';
-
-type CreateDropdownPreactSandboxFailureTestOptions = {
- triggerName: string;
-};
-
-export const createDropdownPreactSandboxFailureTest =
- ({
- triggerName,
- }: CreateDropdownPreactSandboxFailureTestOptions): TwentyUiGalleryPlayFunction =>
- async ({ canvasElement }) => {
- const canvas = within(canvasElement);
- await expectFrontComponentMounted(canvas);
-
- const trigger = canvas.getByRole('button', { name: triggerName });
- expect(trigger).toHaveAttribute('aria-expanded', 'false');
-
- await userEvent.click(trigger);
-
- await expectAssertionToKeepFailing(() =>
- expect(trigger).toHaveAttribute('aria-expanded', 'true'),
- );
- expect(errorHandler).not.toHaveBeenCalled();
- };
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createListItemSandboxFailureTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createListItemSandboxFailureTest.ts
deleted file mode 100644
index e5724a641ab..00000000000
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createListItemSandboxFailureTest.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { expect, userEvent, waitFor, within } from 'storybook/test';
-
-import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
-import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
-import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
-import { expectSandboxErrors } from '@/__stories__/twenty-ui-gallery/utils/expectSandboxErrors';
-
-const MISSING_CONTAINS_ERROR =
- /^(?:Uncaught TypeError: )?\w+\.contains is not a function$/;
-
-export const createListItemSandboxFailureTest =
- (runtime: 'react' | 'preact'): TwentyUiGalleryPlayFunction =>
- async ({ canvasElement }) => {
- const user = userEvent.setup();
- const canvas = within(canvasElement);
- await expectFrontComponentMounted(canvas);
-
- const digest = canvas.getByText('Weekly digest');
-
- await user.click(digest);
- await waitFor(() =>
- expect(canvas.getByRole('status')).toHaveTextContent('Digest: enabled'),
- );
- await user.click(digest);
- await waitFor(() =>
- expect(canvas.getByRole('status')).toHaveTextContent('Digest: disabled'),
- );
- await user.click(canvas.getByText('Disabled preference'));
- expect(canvas.getByRole('status')).toHaveTextContent('Digest: disabled');
- const hiddenFields = canvas.getByRole('button', {
- name: 'Hidden fields',
- });
- await user.click(hiddenFields);
- await waitFor(() => expect(canvas.getByText('Fields: open')).toBeVisible());
-
- if (runtime === 'preact') {
- await expectSandboxErrors({
- requiredErrors: [MISSING_CONTAINS_ERROR],
- });
-
- return;
- }
-
- expect(errorHandler).not.toHaveBeenCalled();
- };
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/currencyPickerTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/currencyPickerTest.ts
new file mode 100644
index 00000000000..b9d6cf8be12
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/currencyPickerTest.ts
@@ -0,0 +1,42 @@
+import { expect, userEvent, within } from 'storybook/test';
+
+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
+import { createDropdownOpenTest } from '@/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest';
+
+const PRIMARY_CURRENCY_TRIGGER_NAME = 'Primary currency';
+
+const primaryCurrencyPickerOpenTest = createDropdownOpenTest({
+ triggerName: PRIMARY_CURRENCY_TRIGGER_NAME,
+ popupText: 'Canadian Dollar',
+});
+
+export const currencyPickerTest: TwentyUiGalleryPlayFunction = async (
+ context,
+) => {
+ const canvas = within(context.canvasElement);
+ const page = within(context.canvasElement.ownerDocument.body);
+ await expectFrontComponentMounted(canvas);
+
+ const primaryTrigger = canvas.getByRole('button', {
+ name: PRIMARY_CURRENCY_TRIGGER_NAME,
+ });
+ const secondaryTrigger = canvas.getByRole('button', {
+ name: 'Secondary currency',
+ });
+ const disabledTrigger = canvas.getByRole('button', {
+ name: 'Disabled currency',
+ });
+
+ expect(primaryTrigger).toHaveTextContent('EUR');
+ expect(secondaryTrigger).toHaveTextContent('USD');
+ expect(disabledTrigger).toBeDisabled();
+ await userEvent.click(disabledTrigger);
+
+ await primaryCurrencyPickerOpenTest(context);
+
+ expect(disabledTrigger).toHaveAttribute('aria-expanded', 'false');
+ expect(
+ page.queryByRole('dialog', { name: 'Disabled currencies' }),
+ ).toBeNull();
+};
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/dropdownTest.ts
similarity index 66%
rename from packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownTest.ts
rename to packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/dropdownTest.ts
index 6602dd194da..4a3cfacd8ef 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createDropdownTest.ts
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/dropdownTest.ts
@@ -1,11 +1,9 @@
import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
import { createDropdownOpenTest } from '@/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest';
-export const createDropdownTest = (
- runtime: 'react' | 'preact',
-): TwentyUiGalleryPlayFunction =>
- createDropdownOpenTest({
- runtime,
+export const dropdownTest: TwentyUiGalleryPlayFunction = createDropdownOpenTest(
+ {
triggerName: 'Choose assignee',
popupText: 'Assign person',
- });
+ },
+);
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/listItemTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/listItemTest.ts
new file mode 100644
index 00000000000..b9c36c121fd
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/listItemTest.ts
@@ -0,0 +1,73 @@
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+
+import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
+import { INTERACTION_TIMEOUT } from '@/__stories__/shared/test-utils/timeouts';
+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
+
+const OVERFLOW_LABEL = 'A long workspace preference that overflows its row';
+
+export const listItemTest: TwentyUiGalleryPlayFunction = async ({
+ canvasElement,
+}) => {
+ const user = userEvent.setup();
+ const canvas = within(canvasElement);
+ const page = within(canvasElement.ownerDocument.body);
+ await expectFrontComponentMounted(canvas);
+
+ const digest = canvas.getByText('Weekly digest');
+
+ await user.click(digest);
+ await waitFor(() =>
+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: enabled'),
+ );
+ await user.click(digest);
+ await waitFor(() =>
+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: disabled'),
+ );
+ await user.click(canvas.getByText('Disabled preference'));
+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: disabled');
+ const hiddenFields = canvas.getByRole('button', {
+ name: 'Hidden fields',
+ });
+ await user.click(hiddenFields);
+ await waitFor(() => expect(canvas.getByText('Fields: open')).toBeVisible());
+
+ const overflowingLabel = canvas.getByText(OVERFLOW_LABEL);
+ await waitFor(
+ () =>
+ expect(overflowingLabel.scrollWidth).toBeGreaterThan(
+ overflowingLabel.clientWidth,
+ ),
+ { timeout: INTERACTION_TIMEOUT },
+ );
+ await waitFor(
+ async () => {
+ await user.unhover(overflowingLabel);
+ await user.hover(overflowingLabel);
+ expect(overflowingLabel).toHaveAttribute('data-content-overflowing');
+ },
+ { timeout: INTERACTION_TIMEOUT },
+ );
+ await user.unhover(overflowingLabel);
+ await user.hover(overflowingLabel);
+ await waitFor(
+ () => {
+ expect(page.getByRole('tooltip')).toHaveTextContent(OVERFLOW_LABEL);
+ expect(page.getByRole('tooltip')).toBeVisible();
+ },
+ { timeout: INTERACTION_TIMEOUT },
+ );
+
+ expect(hiddenFields).toHaveFocus();
+ await user.keyboard('{Escape}');
+ await waitFor(() => expect(canvas.getByText('Fields: closed')).toBeVisible());
+ await waitFor(() =>
+ expect(page.queryByRole('tooltip')).not.toBeInTheDocument(),
+ );
+ await user.click(digest);
+ await waitFor(() =>
+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: enabled'),
+ );
+ expect(errorHandler).not.toHaveBeenCalled();
+};
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createPhoneCountryPickerTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/phoneCountryPickerTest.ts
similarity index 72%
rename from packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createPhoneCountryPickerTest.ts
rename to packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/phoneCountryPickerTest.ts
index 06b85eaaf39..54107d3981b 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createPhoneCountryPickerTest.ts
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/phoneCountryPickerTest.ts
@@ -1,11 +1,8 @@
import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
import { createDropdownOpenTest } from '@/__stories__/twenty-ui-gallery/utils/createDropdownOpenTest';
-export const createPhoneCountryPickerTest = (
- runtime: 'react' | 'preact',
-): TwentyUiGalleryPlayFunction =>
+export const phoneCountryPickerTest: TwentyUiGalleryPlayFunction =
createDropdownOpenTest({
- runtime,
triggerName: 'Primary phone country',
popupText: 'United Kingdom',
});
diff --git a/packages/twenty-sdk/package.json b/packages/twenty-sdk/package.json
index 457f1b44747..2887cb0e71c 100644
--- a/packages/twenty-sdk/package.json
+++ b/packages/twenty-sdk/package.json
@@ -84,7 +84,7 @@
"ink": "^6.8.0",
"inquirer": "^14.0.0",
"jsonc-parser": "^3.2.0",
- "preact": "^10.28.3",
+ "preact": "^11.0.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"semver": "7.6.3",
diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/jsx-runtime-remote-wrapper-plugin.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/jsx-runtime-remote-wrapper-plugin.ts
index 74e0aa429c4..a42b7dc4c34 100644
--- a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/jsx-runtime-remote-wrapper-plugin.ts
+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/jsx-runtime-remote-wrapper-plugin.ts
@@ -14,7 +14,7 @@ export const createJsxRuntimeRemoteWrapperPlugin = (
const usePreact = options?.usePreact ?? false;
const jsxRuntimeModule = usePreact
- ? 'preact/jsx-runtime'
+ ? 'preact/compat/jsx-runtime'
: 'react/jsx-runtime';
const reactModule = usePreact ? 'preact/compat' : 'react';
diff --git a/yarn.lock b/yarn.lock
index 17cc47680a8..e914cd9cc34 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -43784,10 +43784,15 @@ __metadata:
languageName: node
linkType: hard
-"preact@npm:^10.28.3":
- version: 10.28.3
- resolution: "preact@npm:10.28.3"
- checksum: 10c0/e8854fae8d8d40c918538f7a90888dd4f8acd388b8ba8e0c612ed0eb1a7d2cc6c15a7dc0a7b7c7bb5c361d2df63aa283e501cf1d47f8eb1413979cee611a38ef
+"preact@npm:^11.0.0":
+ version: 11.0.0
+ resolution: "preact@npm:11.0.0"
+ peerDependencies:
+ preact-render-to-string: ">=6.7.0"
+ peerDependenciesMeta:
+ preact-render-to-string:
+ optional: true
+ checksum: 10c0/3dfc797d46009e3ec8cf509662077a760301935cb9f5a4bdbdcb26fe69838cf621471742d87a125c6b1237ad78687d5d8fc0798a571038c35fe5e090c37ec502
languageName: node
linkType: hard
@@ -50596,7 +50601,7 @@ __metadata:
ink: "npm:^6.8.0"
inquirer: "npm:^14.0.0"
jsonc-parser: "npm:^3.2.0"
- preact: "npm:^10.28.3"
+ preact: "npm:^11.0.0"
prettier: "npm:^3.1.1"
react: "npm:^19.2.0"
react-dom: "npm:^19.2.0"