Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: export useAsyncData for component Await #6882

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/little-cheetahs-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@ice/runtime': patch
'@ice/app': patch
---

feat: export useAsyncData for component Await
1 change: 1 addition & 0 deletions packages/ice/src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const RUNTIME_EXPORTS = [
'useNavigate',
'useNavigation',
'useRevalidator',
'useAsyncValue',
],
source: '@ice/runtime/router',
},
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export {
useNavigate,
useNavigation,
useRevalidator,
useAsyncValue,
} from 'react-router-dom';

export type {
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export {
useNavigate,
useNavigation,
useRevalidator,
useAsyncValue,
} from 'react-router-dom';

export { useData, useConfig } from './RouteContext.js';
3 changes: 2 additions & 1 deletion packages/runtime/src/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Suspense } from 'react';
import { useRouteError, defer, Await as ReactRouterAwait } from 'react-router-dom';
import type { AwaitProps } from 'react-router-dom';
// eslint-disable-next-line camelcase
import type { UNSAFE_DeferredData, LoaderFunctionArgs } from '@remix-run/router';
import type {
Expand Down Expand Up @@ -105,7 +106,7 @@ export function RouteErrorComponent() {
return process.env.ICE_CORE_ROUTER === 'true' ? <ErrorComponentWithRouter /> : <></>;
}

export function Await(props) {
export function Await(props: AwaitProps & { fallback: React.ReactNode }) {
return process.env.ICE_CORE_ROUTER === 'true' ? (
<Suspense fallback={props.fallback}>
<ReactRouterAwait
Expand Down
Loading