diff --git a/.changeset/thin-parents-scream.md b/.changeset/thin-parents-scream.md new file mode 100644 index 000000000..6d13fb2cf --- /dev/null +++ b/.changeset/thin-parents-scream.md @@ -0,0 +1,5 @@ +--- +"@stackflow/react": patch +--- + +refactor(react): remove `pending: boolean` diff --git a/integrations/react/src/stable/useActions.ts b/integrations/react/src/stable/useActions.ts index aec7e30bc..4c7951473 100644 --- a/integrations/react/src/stable/useActions.ts +++ b/integrations/react/src/stable/useActions.ts @@ -3,7 +3,6 @@ import { useMemo } from "react"; import type { ActivityComponentType } from "../__internal__/ActivityComponentType"; import { makeActivityId } from "../__internal__/activity"; import { useCoreActions } from "../__internal__/core"; -import { useTransition } from "../__internal__/shims"; import type { BaseActivities } from "./BaseActivities"; function parseActionOptions(options?: { animate?: boolean }) { @@ -21,11 +20,6 @@ function parseActionOptions(options?: { animate?: boolean }) { } export type UseActionsOutputType = { - /** - * Is transition pending - */ - pending: boolean; - /** * Push new activity */ @@ -73,11 +67,9 @@ export function useActions< T extends BaseActivities, >(): UseActionsOutputType { const coreActions = useCoreActions(); - const [pending] = useTransition(); return useMemo( () => ({ - pending, push(activityName, activityParams, options) { const activityId = makeActivityId(); @@ -135,6 +127,6 @@ export function useActions< } }, }), - [coreActions?.push, coreActions?.replace, coreActions?.pop, pending], + [coreActions?.push, coreActions?.replace, coreActions?.pop], ); } diff --git a/integrations/react/src/stable/useStepActions.ts b/integrations/react/src/stable/useStepActions.ts index b54fd02fe..40cd79d4e 100644 --- a/integrations/react/src/stable/useStepActions.ts +++ b/integrations/react/src/stable/useStepActions.ts @@ -3,11 +3,9 @@ import { useMemo } from "react"; import type { ActivityComponentType } from "../__internal__/ActivityComponentType"; import { makeStepId } from "../__internal__/activity"; import { useCoreActions } from "../__internal__/core"; -import { useTransition } from "../__internal__/shims"; import type { BaseActivities } from "./BaseActivities"; export type UseStepActionsOutputType

= { - pending: boolean; stepPush: (params: P, options?: {}) => void; stepReplace: (params: P, options?: {}) => void; stepPop: (options?: {}) => void; @@ -27,11 +25,9 @@ export type UseStepActions = < export const useStepActions: UseStepActions = () => { const coreActions = useCoreActions(); - const [pending] = useTransition(); return useMemo( () => ({ - pending, stepPush(params) { const stepId = makeStepId(); @@ -52,11 +48,6 @@ export const useStepActions: UseStepActions = () => { coreActions?.stepPop({}); }, }), - [ - coreActions?.stepPush, - coreActions?.stepReplace, - coreActions?.stepPop, - pending, - ], + [coreActions?.stepPush, coreActions?.stepReplace, coreActions?.stepPop], ); };