File tree Expand file tree Collapse file tree 3 files changed +57
-18
lines changed
apps/cyberstorm-remix/app/p/tabs/Required Expand file tree Collapse file tree 3 files changed +57
-18
lines changed Original file line number Diff line number Diff line change 1+ import { Suspense } from "react" ;
12import { type LoaderFunctionArgs } from "react-router" ;
2- import { useLoaderData } from "react-router" ;
3+ import { useLoaderData , Await } from "react-router" ;
34import { DapperTs } from "@thunderstore/dapper-ts" ;
5+ import { SkeletonBox } from "@thunderstore/cyberstorm" ;
6+ import { PaginatedDependencies } from "~/commonComponents/PaginatedDependencies/PaginatedDependencies" ;
47import {
58 getPublicEnvVariables ,
69 getSessionTools ,
710} from "cyberstorm/security/publicEnvVariables" ;
8- import { PaginatedDependencies } from "~/commonComponents/PaginatedDependencies/PaginatedDependencies" ;
911
1012export async function loader ( { params, request } : LoaderFunctionArgs ) {
1113 if ( params . namespaceId && params . packageId && params . packageVersion ) {
@@ -66,11 +68,22 @@ export async function clientLoader({ params, request }: LoaderFunctionArgs) {
6668}
6769
6870export default function PackageVersionRequired ( ) {
69- const { version, dependencies } = useLoaderData <
70- typeof loader | typeof clientLoader
71- > ( ) ;
71+ const { dependencies } = useLoaderData ( ) ;
7272
7373 return (
74- < PaginatedDependencies version = { version } dependencies = { dependencies } />
74+ < Suspense
75+ fallback = { < SkeletonBox className = "paginated-dependencies__skeleton" /> }
76+ >
77+ < Await
78+ resolve = { dependencies }
79+ errorElement = {
80+ < div > Error occurred while loading required dependencies</ div >
81+ }
82+ >
83+ { ( resolvedDependencies ) => (
84+ < PaginatedDependencies dependencies = { resolvedDependencies } />
85+ ) }
86+ </ Await >
87+ </ Suspense >
7588 ) ;
7689}
Original file line number Diff line number Diff line change 1+ import { Suspense } from "react" ;
12import { type LoaderFunctionArgs } from "react-router" ;
2- import { useLoaderData } from "react-router" ;
3+ import { useLoaderData , Await } from "react-router" ;
34import { DapperTs } from "@thunderstore/dapper-ts" ;
5+ import { SkeletonBox } from "@thunderstore/cyberstorm" ;
6+ import { PaginatedDependencies } from "~/commonComponents/PaginatedDependencies/PaginatedDependencies" ;
47import {
58 getPublicEnvVariables ,
69 getSessionTools ,
710} from "cyberstorm/security/publicEnvVariables" ;
8- import { PaginatedDependencies } from "~/commonComponents/PaginatedDependencies/PaginatedDependencies" ;
911
1012export async function loader ( { params, request } : LoaderFunctionArgs ) {
1113 if ( params . namespaceId && params . packageId && params . packageVersion ) {
@@ -66,11 +68,22 @@ export async function clientLoader({ params, request }: LoaderFunctionArgs) {
6668}
6769
6870export default function PackageVersionWithoutCommunityRequired ( ) {
69- const { version, dependencies } = useLoaderData <
70- typeof loader | typeof clientLoader
71- > ( ) ;
71+ const { dependencies } = useLoaderData ( ) ;
7272
7373 return (
74- < PaginatedDependencies version = { version } dependencies = { dependencies } />
74+ < Suspense
75+ fallback = { < SkeletonBox className = "paginated-dependencies__skeleton" /> }
76+ >
77+ < Await
78+ resolve = { dependencies }
79+ errorElement = {
80+ < div > Error occurred while loading required dependencies</ div >
81+ }
82+ >
83+ { ( resolvedDependencies ) => (
84+ < PaginatedDependencies dependencies = { resolvedDependencies } />
85+ ) }
86+ </ Await >
87+ </ Suspense >
7588 ) ;
7689}
Original file line number Diff line number Diff line change 1+ import { Suspense } from "react" ;
12import { type LoaderFunctionArgs } from "react-router" ;
2- import { useLoaderData } from "react-router" ;
3+ import { useLoaderData , Await } from "react-router" ;
34import { DapperTs } from "@thunderstore/dapper-ts" ;
5+ import { SkeletonBox } from "@thunderstore/cyberstorm" ;
6+ import { PaginatedDependencies } from "~/commonComponents/PaginatedDependencies/PaginatedDependencies" ;
47import {
58 getPublicEnvVariables ,
69 getSessionTools ,
710} from "cyberstorm/security/publicEnvVariables" ;
8- import { PaginatedDependencies } from "~/commonComponents/PaginatedDependencies/PaginatedDependencies" ;
911
1012export async function loader ( { params, request } : LoaderFunctionArgs ) {
1113 if ( params . communityId && params . namespaceId && params . packageId ) {
@@ -76,11 +78,22 @@ export async function clientLoader({ params, request }: LoaderFunctionArgs) {
7678}
7779
7880export default function PackageVersionRequired ( ) {
79- const { version, dependencies } = useLoaderData <
80- typeof loader | typeof clientLoader
81- > ( ) ;
81+ const { dependencies } = useLoaderData ( ) ;
8282
8383 return (
84- < PaginatedDependencies version = { version } dependencies = { dependencies } />
84+ < Suspense
85+ fallback = { < SkeletonBox className = "paginated-dependencies__skeleton" /> }
86+ >
87+ < Await
88+ resolve = { dependencies }
89+ errorElement = {
90+ < div > Error occurred while loading required dependencies</ div >
91+ }
92+ >
93+ { ( resolvedDependencies ) => (
94+ < PaginatedDependencies dependencies = { resolvedDependencies } />
95+ ) }
96+ </ Await >
97+ </ Suspense >
8598 ) ;
8699}
You can’t perform that action at this time.
0 commit comments