File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
src/components/overlays/Dialog Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @cube-dev/ui-kit ' : patch
3+ ---
4+
5+ Fixes false error in useDialogContainer.
Original file line number Diff line number Diff line change @@ -25,25 +25,25 @@ export function useDialogContainer<
2525 const [ containerProps , setContainerProps ] = useState < E | null > ( null ) ;
2626 const setupRef = useRef ( false ) ;
2727
28- // 'open' accepts props required by the Component and opens the dialog
29- const open = useEvent ( ( props : P , containerProps ?: E ) => {
28+ function setupCheck ( ) {
3029 if ( ! setupRef . current ) {
3130 throw new Error (
3231 'useDialogContainer: DialogContainer must be rendered. Use `rendered` property to include it in your component tree.' ,
3332 ) ;
3433 }
34+ }
35+
36+ // 'open' accepts props required by the Component and opens the dialog
37+ const open = useEvent ( ( props : P , containerProps ?: E ) => {
38+ setupCheck ( ) ;
3539
3640 setComponentProps ( props ) ;
3741 setContainerProps ( containerProps ?? null ) ;
3842 setIsOpen ( true ) ;
3943 } ) ;
4044
4145 const update = useEvent ( ( props : P , containerProps ?: E ) => {
42- if ( ! setupRef . current ) {
43- throw new Error (
44- 'useDialogContainer: DialogContainer must be rendered. Use `rendered` property to include it in your component tree.' ,
45- ) ;
46- }
46+ setupCheck ( ) ;
4747
4848 setComponentProps ( props ) ;
4949 setContainerProps ( containerProps ?? null ) ;
You can’t perform that action at this time.
0 commit comments