File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export const CoreStateContext = createContext<{
1313
1414export interface CoreProviderProps {
1515 coreStore : CoreStore ;
16+ transition : boolean ;
1617 children : JSXElement ;
1718}
1819export const CoreProvider : Component < CoreProviderProps > = ( props ) => {
@@ -22,14 +23,15 @@ export const CoreProvider: Component<CoreProviderProps> = (props) => {
2223 const [ pending , startTransition ] = useTransition ( ) ;
2324
2425 props . coreStore . subscribe ( ( ) => {
25- startTransition ( ( ) => {
26+ const update = ( ) =>
2627 setStack (
2728 reconcile (
2829 JSON . parse ( JSON . stringify ( props . coreStore . actions . getStack ( ) ) ) ,
2930 { merge : true } ,
3031 ) ,
3132 ) ;
32- } ) ;
33+ if ( props . transition ) startTransition ( update ) ;
34+ else update ( ) ;
3335 } ) ;
3436
3537 return (
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ import type { Component } from "solid-js";
33export type StackComponentType = Component < {
44 initialContext ?: any ;
55 initialLoaderData ?: any ;
6+ transition ?: boolean ;
67} > ;
Original file line number Diff line number Diff line change @@ -149,7 +149,10 @@ export function stackflow<
149149 return (
150150 < ConfigProvider value = { input . config } >
151151 < PluginsProvider value = { coreStore . pluginInstances } >
152- < CoreProvider coreStore = { coreStore } >
152+ < CoreProvider
153+ coreStore = { coreStore }
154+ transition = { props . transition ?? true }
155+ >
153156 < MainRenderer
154157 activityComponentMap = { input . components }
155158 initialContext = { initialContext ( ) }
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { useStepActions } from "./useStepActions";
2525
2626export type StackComponentType = Component < {
2727 initialContext ?: any ;
28+ transition ?: boolean ;
2829} > ;
2930
3031type StackflowPluginsEntry < T extends BaseActivities > =
@@ -197,7 +198,10 @@ export function stackflow<T extends BaseActivities>(
197198
198199 return (
199200 < PluginsProvider value = { coreStore . pluginInstances } >
200- < CoreProvider coreStore = { coreStore } >
201+ < CoreProvider
202+ coreStore = { coreStore }
203+ transition = { props . transition ?? true }
204+ >
201205 < MainRenderer
202206 activityComponentMap = { activityComponentMap }
203207 initialContext = { props . initialContext }
You can’t perform that action at this time.
0 commit comments