|
1
|
"use client" |
|
2
|
|
|
3
|
import React from "react" |
|
4
|
import { useCurrentLearningPath } from "../../hooks/use-current-learning-path" |
|
5
|
import { usePageScrollManager } from "../../hooks/use-page-scroll-manager" |
|
6
|
|
|
7
|
type HooksLoaderProps = { |
|
8
|
options?: { |
|
9
|
pageScrollManager?: boolean |
|
10
|
currentLearningPath?: boolean |
|
11
|
} |
|
12
|
children?: React.ReactNode |
|
13
|
} |
|
14
|
|
|
15
|
export const HooksLoader = ({ children, options = {} }: HooksLoaderProps) => { |
|
16
|
const { pageScrollManager, currentLearningPath } = options |
|
17
|
// load any hooks that require providers to be loaded here. |
|
18
|
if (pageScrollManager) { |
|
19
|
usePageScrollManager() |
|
20
|
} |
|
21
|
if (currentLearningPath) { |
|
22
|
useCurrentLearningPath() |
|
23
|
} |
|
24
|
|
|
25
|
return <>{children}</> |
|
26
|
} |