-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Refactor BuildersCheckInCount to render a child server component. This bend the pattern composition rule but works thanks to the fact that all the child component are serializable. (This would be explained more in the PR) - Add CounterDisplay server component wich is rendered in the server, sent to the client and the rehydrated with the current values when the become available in the client component.
- Loading branch information
1 parent
295ef19
commit 9a7e113
Showing
2 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { displayTxResult } from "../debug/_components/contract"; | ||
import { ArrowPathIcon } from "@heroicons/react/16/solid"; | ||
|
||
export async function CounterDisplay({ | ||
data: counter, | ||
isLoading, | ||
error, | ||
}: { | ||
data?: bigint; | ||
isLoading: boolean; | ||
error: Error | null; | ||
}) { | ||
return ( | ||
<div className="text-lg flex gap-2 justify-center items-center"> | ||
<span className="font-bold">Checked in builders count:</span> | ||
{isLoading || (!error && !counter) ? ( | ||
<ArrowPathIcon className="size-5 animate-spin" /> | ||
) : error ? ( | ||
<span className="text-error">Error!</span> | ||
) : ( | ||
<span>{displayTxResult(counter)}</span> | ||
)} | ||
</div> | ||
); | ||
} |