File tree Expand file tree Collapse file tree
integrations/react/src/stable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ import { useActions } from "./useActions";
2626import type { UseStepActionsOutputType } from "./useStepActions" ;
2727import { useStepActions } from "./useStepActions" ;
2828
29+ import { version } from "react" ;
30+
2931function parseActionOptions ( options ?: { animate ?: boolean } ) {
3032 if ( ! options ) {
3133 return { skipActiveState : false } ;
@@ -145,9 +147,18 @@ export function stackflow<T extends BaseActivities>(
145147 ...( options . plugins ?? [ ] )
146148 . flat ( Number . POSITIVE_INFINITY as 0 )
147149 . map ( ( p ) => p as StackflowReactPlugin ) ,
148- lazyActivityPlugin ( activityComponentMap ) ,
149150 ] ;
150151
152+ const majorReactVersion = Number . parseInt ( version ) ;
153+
154+ /**
155+ * TODO: This plugin depends on internal APIs of React.
156+ * A proper solution (e.g. Suspense integration) should be implemented in the next major version.
157+ */
158+ if ( majorReactVersion >= 18 && majorReactVersion <= 19 ) {
159+ plugins . push ( lazyActivityPlugin ( activityComponentMap ) ) ;
160+ }
161+
151162 const enoughPastTime = ( ) =>
152163 new Date ( ) . getTime ( ) - options . transitionDuration * 2 ;
153164
You can’t perform that action at this time.
0 commit comments