Skip to content

Commit 110ef12

Browse files
committed
feat: add option to disable transition in solid integration
1 parent 029aed5 commit 110ef12

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

integrations/solid/src/__internal__/core/CoreProvider.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const CoreStateContext = createContext<{
1313

1414
export interface CoreProviderProps {
1515
coreStore: CoreStore;
16+
transition: boolean;
1617
children: JSXElement;
1718
}
1819
export 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 (

integrations/solid/src/future/StackComponentType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import type { Component } from "solid-js";
33
export type StackComponentType = Component<{
44
initialContext?: any;
55
initialLoaderData?: any;
6+
transition?: boolean;
67
}>;

integrations/solid/src/future/stackflow.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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()}

integrations/solid/src/stable/stackflow.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useStepActions } from "./useStepActions";
2525

2626
export type StackComponentType = Component<{
2727
initialContext?: any;
28+
transition?: boolean;
2829
}>;
2930

3031
type 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}

0 commit comments

Comments
 (0)