Refactor cache functions to use explicit loaders
The commit refactors the previous implementation of using cache functions across several modules. They are now explicitly defined as loaders to improve readability and maintain a consistent style. This prevents the cache function calls from getting too nested and difficult to understand, especially in asynchronous cases. Additionally, the user session related hooks are deleted which were not used anymore.
This commit is contained in:
@@ -12,11 +12,13 @@ import { SitePageHeader } from '../../_components/site-page-header';
|
||||
import styles from '../../blog/_components/html-renderer.module.css';
|
||||
import { DocsCards } from '../_components/docs-cards';
|
||||
|
||||
const getPageBySlug = cache(async (slug: string) => {
|
||||
const getPageBySlug = cache(pageLoader);
|
||||
|
||||
async function pageLoader(slug: string) {
|
||||
const client = await createCmsClient();
|
||||
|
||||
return client.getContentItemBySlug({ slug, collection: 'documentation' });
|
||||
});
|
||||
return client.getContentItemBySlug({ slug, collection: 'pages' });
|
||||
}
|
||||
|
||||
interface PageParams {
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user