Side panel crash from unguarded onTransitionEnd bubbling

https://sonarly.com/issue/19891?type=bug

SidePanelRecordPage throws "Record id is not defined" when a child CSS transitionend event bubbles to SidePanelForDesktop's onTransitionEnd handler, triggering premature state cleanup during the close animation and leaving the component with an empty instanceId context pointing to an unpopulated atom.
This commit is contained in:
Sonarly Claude Code
2026-03-31 08:56:58 +00:00
parent 61a27984e8
commit 256dbd7fc2
@@ -18,7 +18,7 @@ import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { styled } from '@linaria/react';
import { useCallback, useState } from 'react';
import { type TransitionEvent, useCallback, useState } from 'react';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSidePanelWrapper = styled.div<{
@@ -81,7 +81,16 @@ export const SidePanelForDesktop = () => {
const shouldShowContent = isSidePanelOpened || shouldRenderContent;
const handleTransitionEnd = () => {
const handleTransitionEnd = (
event: TransitionEvent<HTMLDivElement>,
) => {
if (
event.target !== event.currentTarget ||
event.propertyName !== 'width'
) {
return;
}
if (isSidePanelOpened) {
// Open animation completed - ensure content persists for close animation
setShouldRenderContent(true);