Skip to content

Commit

Permalink
fix(Example): adding Suspense to wait font to be loaded (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed May 11, 2023
1 parent b62c7a8 commit 998aa88
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ export const Example = React.forwardRef<ExampleApi, ExampleProps>(

return (
<group {...props}>
<Center top cacheKey={JSON.stringify({ counter, font })}>
<Text3D bevelEnabled bevelSize={bevelSize} font={font}>
{counter}
{debug ? <meshNormalMaterial wireframe /> : <meshStandardMaterial color={color} />}
</Text3D>
</Center>
<React.Suspense fallback={null}>
<Center top cacheKey={JSON.stringify({ counter, font })}>
<Text3D bevelEnabled bevelSize={bevelSize} font={font}>
{debug ? <meshNormalMaterial wireframe /> : <meshStandardMaterial color={color} />}
{counter}
</Text3D>
</Center>
</React.Suspense>
{children}
</group>
)
Expand Down

1 comment on commit 998aa88

@vercel
Copy link

@vercel vercel bot commented on 998aa88 May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.