Skip to content

Commit 37dd885

Browse files
committed
fix(DialogHeader): valve rewrote component on beta, update filter to search for both versions
1 parent ed87f73 commit 37dd885

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/components/Dialog.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CSSProperties, FC, ReactNode, RefAttributes } from 'react';
22

3-
import { CommonUIModule } from '../webpack';
3+
import { CommonUIModule, Module } from '../webpack';
44
import { FooterLegendProps } from './FooterLegend';
55

66
export interface DialogCommonProps extends RefAttributes<HTMLDivElement> {
@@ -68,7 +68,12 @@ const MappedDialogDivs = new Map(
6868
}),
6969
);
7070

71-
export const DialogHeader = MappedDialogDivs.get('DialogHeader') as FC<DialogCommonProps>;
71+
// Old | New
72+
export const DialogHeader = (MappedDialogDivs.get('DialogHeader') || Object.values(CommonUIModule).find((component: Module) => {
73+
const str = component?.render?.toString?.();
74+
return str?.includes("role:\"heading\"") && str.includes(")(\"DialogHeader\",");
75+
})) as FC<DialogCommonProps>;
76+
7277
export const DialogSubHeader = MappedDialogDivs.get('DialogSubHeader') as FC<DialogCommonProps>;
7378
export const DialogFooter = MappedDialogDivs.get('DialogFooter') as FC<DialogCommonProps>;
7479
export const DialogLabel = MappedDialogDivs.get('DialogLabel') as FC<DialogCommonProps>;

0 commit comments

Comments
 (0)