diff --git a/package.json b/package.json index 2461cd4..8a2f918 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "@stackflow/core": "^1.1.1", "@stackflow/plugin-basic-ui": "^1.11.1", + "@stackflow/plugin-history-sync": "^1.7.1", "@stackflow/plugin-renderer-basic": "^1.1.13", "@stackflow/react": "^1.4.2", "@tailwindcss/vite": "^4.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca0830c..e2af8c1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@stackflow/plugin-basic-ui': specifier: ^1.11.1 version: 1.11.1(@stackflow/core@1.1.1)(@stackflow/react@1.4.2(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1) + '@stackflow/plugin-history-sync': + specifier: ^1.7.1 + version: 1.7.1(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@stackflow/react@1.4.2(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1) '@stackflow/plugin-renderer-basic': specifier: ^1.1.13 version: 1.1.13(@stackflow/core@1.1.1)(@stackflow/react@1.4.2(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1) @@ -532,6 +535,15 @@ packages: '@types/react': '>=16.8.0' react: '>=16.8.0' + '@stackflow/plugin-history-sync@1.7.1': + resolution: {integrity: sha512-qgmqil2We1Hjcg6pu5jvrOUAi98hbdQF2/d3KGnOurCUc8PYxl8o0JKbyTkoOMBRDeBOVgtQBwpHEYB3t3jwvQ==} + peerDependencies: + '@stackflow/config': ^1.0.1-canary.0 + '@stackflow/core': ^1.1.0-canary.0 + '@stackflow/react': ^1.3.2-canary.0 + '@types/react': '>=16.8.0' + react: '>=16.8.0' + '@stackflow/plugin-renderer-basic@1.1.13': resolution: {integrity: sha512-8C5QwFagDycFuBLfQ9ynVfpDeO9qeIeGYS3GkZ1Drv3nlc7lE0q1DAGJHLXGLTdra9mzsHCirrGR6sgYa1OA0w==} peerDependencies: @@ -2053,6 +2065,17 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros + '@stackflow/plugin-history-sync@1.7.1(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@stackflow/react@1.4.2(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1)': + dependencies: + '@stackflow/config': 1.2.1 + '@stackflow/core': 1.1.1 + '@stackflow/react': 1.4.2(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@types/react@18.3.18)(react@18.3.1) + '@types/react': 18.3.18 + flatted: 3.3.2 + history: 5.3.0 + react: 18.3.1 + url-pattern: 1.0.3 + '@stackflow/plugin-renderer-basic@1.1.13(@stackflow/core@1.1.1)(@stackflow/react@1.4.2(@stackflow/config@1.2.1)(@stackflow/core@1.1.1)(@types/react@18.3.18)(react@18.3.1))(@types/react@18.3.18)(react@18.3.1)': dependencies: '@stackflow/core': 1.1.1 diff --git a/src/stackflow.ts b/src/stackflow.ts index 2db0efa..346562d 100644 --- a/src/stackflow.ts +++ b/src/stackflow.ts @@ -1,4 +1,5 @@ import { basicUIPlugin } from '@stackflow/plugin-basic-ui'; +import { historySyncPlugin } from '@stackflow/plugin-history-sync'; import { basicRendererPlugin } from '@stackflow/plugin-renderer-basic'; import { stackflow } from '@stackflow/react'; import CourseSelectionActivity from './pages/CourseSelectionActivity'; @@ -12,11 +13,18 @@ export const { Stack, useFlow } = stackflow({ basicUIPlugin({ theme: 'cupertino', }), + historySyncPlugin({ + routes: { + OnboardingActivity: '/', + CourseSelectionActivity: '/course-selection', + DesiredCreditActivity: '/desired-credit', + }, + fallbackActivity: () => 'OnboardingActivity', + }), ], activities: { OnboardingActivity, CourseSelectionActivity, DesiredCreditActivity, }, - initialActivity: () => 'OnboardingActivity', });