Skip to content

Commit f997ebb

Browse files
committed
fix(studio): retire legacy Style and Grade sections from flat inspector
The flat inspector rendered its new Style/Grade groups AND the legacy ColorGradingSection/StyleSections components a second time below them, visibly doubling every control. Remove the now-redundant legacy render call sites (and their now-unused imports) from PropertyPanelFlat.tsx; those components stay intact for the legacy (flag-off) PropertyPanel.
1 parent b4e30fe commit f997ebb

2 files changed

Lines changed: 41 additions & 35 deletions

File tree

‎packages/studio/src/components/editor/PropertyPanel.test.tsx‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,45 @@ describe("PropertyPanel — Grade group (flag on)", () => {
692692
},
693693
RENDER_TIMEOUT_MS,
694694
);
695+
696+
it(
697+
"does not render the legacy Style/Grade Section duplicates for a style-and-grade-editable element",
698+
async () => {
699+
// A <video> with no text fields is both style-editable (inherited
700+
// capabilities.canEditStyles: true) and grade-editable (tag === "video"),
701+
// so both the flat Style and Grade groups render — the exact shape that
702+
// used to also mount the legacy ColorGradingSection + StyleSections below
703+
// them (the hybrid-duplication bug this task retires).
704+
const { host, root } = await renderPanel(true, {
705+
...baseElement(),
706+
tagName: "video",
707+
textFields: [],
708+
});
709+
expect(host.textContent).toContain("Style");
710+
expect(host.textContent).toContain("Grade");
711+
// The legacy `Section` primitive (propertyPanelStyleSections.tsx /
712+
// propertyPanelColorGradingSection.tsx) renders a `<section
713+
// data-panel-section="<slugified-title>">` for each of its sections. A
714+
// bare textContent check can't tell a legacy Section title apart from a
715+
// flat row label with the same word — "Fill" is both the legacy Fill
716+
// `Section` title AND a row label inside FlatStyleSection, which is
717+
// supposed to still be there — so assert on the legacy Section's actual
718+
// DOM shape instead of a substring match.
719+
for (const slug of [
720+
"radius",
721+
"stroke",
722+
"effects",
723+
"clip",
724+
"transparency",
725+
"fill",
726+
"color-grading",
727+
]) {
728+
expect(host.querySelector(`[data-panel-section="${slug}"]`)).toBeNull();
729+
}
730+
act(() => root.unmount());
731+
},
732+
RENDER_TIMEOUT_MS,
733+
);
695734
});
696735

697736
describe("PropertyPanel — Media group (Plan 4)", () => {

‎packages/studio/src/components/editor/PropertyPanelFlat.tsx‎

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ import { FlatMotionSection } from "./propertyPanelFlatMotionSection";
1414
import { FlatMediaSection } from "./propertyPanelFlatMediaSection";
1515
import { deriveElementTiming } from "./propertyPanelFlatTimingDerivation";
1616
import { createGsapLivePreview } from "./gsapLivePreview";
17-
import { formatTextFieldPreview, StyleSections } from "./propertyPanelSections";
17+
import { formatTextFieldPreview } from "./propertyPanelSections";
1818
import { STUDIO_GSAP_PANEL_ENABLED } from "./manualEditingAvailability";
19-
import { ColorGradingSection } from "./propertyPanelColorGradingSection";
2019
import { useColorGradingController } from "./useColorGradingController";
2120
import { usePersistedPinnedGroups } from "../../hooks/usePersistedPinnedGroups";
2221
import {
@@ -55,8 +54,7 @@ const EMPTY_GSAP_EFFECT_HANDLERS = {
5554
* (same one-directional-import precedent as FlatTextSection). Rendered only
5655
* when STUDIO_FLAT_INSPECTOR_ENABLED is on; owns the one-open/pin group state.
5756
*
58-
* The Text/Style/Layout/Motion/Media groups share the one-open accordion. The
59-
* legacy Color-Grading section renders unchanged below the flat groups.
57+
* The Text/Style/Layout/Motion/Media/Grade groups share the one-open accordion.
6058
*/
6159
// fallow-ignore-next-line complexity
6260
export function PropertyPanelFlat({
@@ -502,37 +500,6 @@ export function PropertyPanelFlat({
502500
{g.content}
503501
</FlatGroup>
504502
))}
505-
{sections.colorGrading && (
506-
<ColorGradingSection
507-
key={[
508-
element.id ?? "",
509-
element.hfId ?? "",
510-
element.selector ?? "",
511-
String(element.selectorIndex ?? ""),
512-
].join("|")}
513-
projectId={projectId}
514-
element={element}
515-
assets={assets}
516-
previewIframeRef={previewIframeRef}
517-
onImportAssets={onImportAssets}
518-
onSetAttributeLive={onSetAttributeLive}
519-
onApplyScope={onApplyColorGradingScope}
520-
/>
521-
)}
522-
{showEditableSections && (
523-
<StyleSections
524-
projectId={projectId}
525-
element={element}
526-
styles={styles}
527-
assets={assets}
528-
onSetStyle={onSetStyle}
529-
onImportAssets={onImportAssets}
530-
gsapBorderRadius={gsapBorderRadius}
531-
// Flex now lives in the flat Layout group (LayoutFlexBlock); suppress
532-
// the legacy StyleSections Flex `Section` so it renders exactly once.
533-
hideFlex
534-
/>
535-
)}
536503
</div>
537504
<PropertyPanelFlatFooter
538505
onAskAgent={onAskAgent}

0 commit comments

Comments
 (0)