From 600705130f83a2e05e880d725b193f666e9f6bcf Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Wed, 10 Jan 2024 12:42:48 +0100 Subject: [PATCH] #483: Enable the Template prop not to be lazy --- src/account/pages/PageProps.ts | 4 ++-- src/login/pages/PageProps.ts | 4 ++-- src/tools/LazyOrNot.ts | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 src/tools/LazyOrNot.ts diff --git a/src/account/pages/PageProps.ts b/src/account/pages/PageProps.ts index afd32504..15ec16aa 100644 --- a/src/account/pages/PageProps.ts +++ b/src/account/pages/PageProps.ts @@ -1,9 +1,9 @@ -import type { LazyExoticComponent } from "react"; import type { I18n } from "keycloakify/account/i18n"; import type { TemplateProps, ClassKey } from "keycloakify/account/TemplateProps"; +import type { LazyOrNot } from "keycloakify/tools/LazyOrNot"; export type PageProps = { - Template: LazyExoticComponent<(props: TemplateProps) => JSX.Element | null>; + Template: LazyOrNot<(props: TemplateProps) => JSX.Element | null>; kcContext: KcContext; i18n: I18nExtended; doUseDefaultCss: boolean; diff --git a/src/login/pages/PageProps.ts b/src/login/pages/PageProps.ts index 32fbb534..6e513130 100644 --- a/src/login/pages/PageProps.ts +++ b/src/login/pages/PageProps.ts @@ -1,9 +1,9 @@ -import type { LazyExoticComponent } from "react"; import type { I18n } from "keycloakify/login/i18n"; import { type TemplateProps, type ClassKey } from "keycloakify/login/TemplateProps"; +import type { LazyOrNot } from "keycloakify/tools/LazyOrNot"; export type PageProps = { - Template: LazyExoticComponent<(props: TemplateProps) => JSX.Element | null>; + Template: LazyOrNot<(props: TemplateProps) => JSX.Element | null>; kcContext: KcContext; i18n: I18nExtended; doUseDefaultCss: boolean; diff --git a/src/tools/LazyOrNot.ts b/src/tools/LazyOrNot.ts new file mode 100644 index 00000000..64d870d1 --- /dev/null +++ b/src/tools/LazyOrNot.ts @@ -0,0 +1,3 @@ +import type { LazyExoticComponent, ComponentType } from "react"; + +export type LazyOrNot> = LazyExoticComponent | Component;