Skip to content

Commit af3aaee

Browse files
committed
Make all params of the next API required
1 parent b73ac60 commit af3aaee

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/next-appdir/DsfrHead.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export type DsfrHeadProps = {
2121
* Preloading of fonts is only enabled in production.
2222
*/
2323
preloadFonts?: (keyof typeof fontUrlByFileBasename)[];
24-
/** Default: <a /> */
25-
Link?: Function;
24+
Link: Function;
2625
/**
2726
* When set, the value will be used as the nonce attribute of subsequent script tags.
2827
*
@@ -67,9 +66,7 @@ export function DsfrHead(props: DsfrHeadProps) {
6766
const defaultColorScheme = getDefaultColorSchemeServerSide();
6867

6968
useMemo(() => {
70-
if (Link !== undefined) {
71-
setLink({ "Link": Link as any });
72-
}
69+
setLink({ "Link": Link as any });
7370
}, [Link]);
7471

7572
return (

src/next-appdir/DsfrProvider.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import { setLink } from "../link";
1111

1212
export type DsfrProviderProps = {
1313
children: ReactNode;
14-
lang?: string;
15-
/** Default: <a /> */
16-
Link?: Function;
14+
lang: string | undefined;
15+
Link: Function;
1716
defaultColorScheme: DefaultColorScheme;
1817
};
1918

@@ -33,9 +32,7 @@ export function DsfrProvider(props: DsfrProviderProps) {
3332
}, [lang]);
3433

3534
useMemo(() => {
36-
if (Link !== undefined) {
37-
setLink({ "Link": Link as any });
38-
}
35+
setLink({ "Link": Link as any });
3936
}, [Link]);
4037

4138
if (isBrowser) {

src/next-appdir/getHtmlAttributes.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const suppressHydrationWarning = true;
1010

1111
export function getHtmlAttributes(params: {
1212
defaultColorScheme: DefaultColorScheme;
13-
lang?: string;
13+
lang: string | undefined;
1414
}): { suppressHydrationWarning: true; lang?: string } & (
1515
| Record<typeof data_fr_scheme | typeof data_fr_theme, ColorScheme>
1616
| {}

0 commit comments

Comments
 (0)