Skip to content

Commit

Permalink
Update the fallback page example
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrHoroshih committed Aug 12, 2023
1 parent 605b565 commit 38e8658
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/playground-app/pages/breweries-pages/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
$list,
$currentBrewery,
} from "#root/features/breweries";
import { sleep } from "#root/shared/lib/sleep";

import { allSettled, fork, serialize } from "effector";
import { useRouter } from "next/router";

Expand Down Expand Up @@ -33,6 +35,11 @@ export const getStaticProps = async ({

const values = serialize(scope);

/**
* Force a delay to show the "fallback" loading state
*/
await sleep(1000);

return {
props: {
values,
Expand All @@ -45,7 +52,12 @@ export default function Page() {
const router = useRouter();

if (router.isFallback) {
return <div>loading...</div>;
return (
<div>
<div>loading...</div>
<div>(This is a `router.isFallback` state)</div>
</div>
);
}

if (!brewery) {
Expand Down

0 comments on commit 38e8658

Please sign in to comment.