🐛 fix: Fix ssr

This commit is contained in:
canisminor1990
2023-07-17 11:25:08 +08:00
parent a51cc0cf9f
commit a834e76104
3 changed files with 17 additions and 8 deletions

View File

@@ -38,13 +38,13 @@ const Chat = memo(() => {
});
export default Chat;
export const getStaticPaths = async () => {
return {
fallback: 'blocking',
paths: [],
};
};
// export const getStaticPaths = async () => {
// return {
// fallback: 'blocking',
// paths: [],
// };
// };
export const getStaticProps = async (context: any) => ({
export const getServerSideProps = async (context: any) => ({
props: await serverSideTranslations(context.locale),
});

View File

@@ -5,13 +5,20 @@ import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { settingsSelectors, useSettings } from '@/store/settings';
import { ConfigKeys } from '@/types/exportConfig';
type SettingItemGroup = ItemGroup & {
children: {
name: ConfigKeys;
}[];
};
const SettingForm = memo(() => {
const settings = useSettings(settingsSelectors.currentSettings, isEqual);
const { t } = useTranslation('setting');
const theme: ItemGroup = useMemo(
const theme: SettingItemGroup = useMemo(
() => ({
children: [
{

View File

@@ -8,6 +8,8 @@ export interface ConfigSettings {
avatar?: string;
}
export type ConfigKeys = keyof ConfigSettings;
export interface ConfigState {
settings: ConfigSettings;
}