@@ -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 } ) {
3032if ( ! options ) {
3133return { 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+
151162const enoughPastTime = ( ) =>
152163new Date ( ) . getTime ( ) - options . transitionDuration * 2 ;
153164