confirmed SSR support with Remix

This commit is contained in:
dswbx
2024-11-25 19:59:46 +01:00
parent 1c94777317
commit eea76ebc28
15 changed files with 144 additions and 44 deletions

View File

@@ -9,8 +9,9 @@ export const meta: MetaFunction = () => {
export const loader = async (args: LoaderFunctionArgs) => {
const api = args.context.api as Api;
const user = api.getAuthState().user;
const { data } = await api.data.readMany("todos");
return { data };
return { data, user };
};
export default function Index() {

View File

@@ -6,6 +6,7 @@ import "bknd/dist/styles.css";
export default function AdminPage() {
const [loaded, setLoaded] = useState(false);
useEffect(() => {
if (typeof window === "undefined") return;
setLoaded(true);
}, []);
if (!loaded) return null;