@inertiajs/svelte 3.2.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -174,10 +174,8 @@
174
174
  onProgress,
175
175
  onFinish,
176
176
  onCancel,
177
- onSuccess: (...args) => {
178
- if (onSuccess) {
179
- onSuccess(...args)
180
- }
177
+ onSuccess: async (...args) => {
178
+ const result = await onSuccess?.(...args)
181
179
 
182
180
  if (onSubmitComplete) {
183
181
  onSubmitComplete({
@@ -191,6 +189,8 @@
191
189
  if (setDefaultsOnSuccess === true) {
192
190
  defaults()
193
191
  }
192
+
193
+ return result
194
194
  },
195
195
  onError: (...args) => {
196
196
  if (onError) {
@@ -118,9 +118,7 @@
118
118
  return infiniteScrollInstance?.dataManager.hasNext() || false
119
119
  }
120
120
 
121
- onMount(() => {
122
- setTimeout(setupInfiniteScrollInstance)
123
- })
121
+ onMount(setupInfiniteScrollInstance)
124
122
 
125
123
  function syncStateFromDataManager() {
126
124
  requestCount = infiniteScrollInstance!.dataManager.getRequestCount()
@@ -10,8 +10,9 @@ type SetupOptions<SharedProps extends PageProps> = {
10
10
  App: typeof App;
11
11
  props: InertiaAppProps<SharedProps>;
12
12
  };
13
- type SvelteWithApp = (context: Map<any, any>, options: {
13
+ type SvelteWithApp<SharedProps extends PageProps> = (context: Map<any, any>, options: {
14
14
  ssr: boolean;
15
+ page: Page<SharedProps>;
15
16
  }) => void;
16
17
  type InertiaAppOptionsForCSR<SharedProps extends PageProps> = CreateInertiaAppOptionsForCSR<SharedProps, ComponentResolver, SetupOptions<SharedProps>, SvelteRenderResult | void, SvelteInertiaAppConfig> & {
17
18
  withApp?: never;
@@ -20,7 +21,7 @@ type InertiaAppOptionsAuto<SharedProps extends PageProps> = Omit<CreateInertiaAp
20
21
  page?: Page<SharedProps>;
21
22
  } & ({
22
23
  setup?: undefined;
23
- withApp?: SvelteWithApp;
24
+ withApp?: SvelteWithApp<SharedProps>;
24
25
  } | {
25
26
  setup: (options: SetupOptions<SharedProps>) => SvelteRenderResult | void;
26
27
  withApp?: never;
@@ -32,7 +32,7 @@ export default async function createInertiaApp({ id = 'app', resolve, setup, pro
32
32
  else {
33
33
  const context = new Map();
34
34
  if (withApp) {
35
- withApp(context, { ssr: true });
35
+ withApp(context, { ssr: true, page });
36
36
  }
37
37
  svelteApp = render(App, { props, context });
38
38
  }
@@ -70,7 +70,7 @@ export default async function createInertiaApp({ id = 'app', resolve, setup, pro
70
70
  else {
71
71
  const context = new Map();
72
72
  if (withApp) {
73
- withApp(context, { ssr: false });
73
+ withApp(context, { ssr: false, page: initialPage });
74
74
  }
75
75
  if (target.hasAttribute('data-server-rendered')) {
76
76
  hydrate(App, { target, props, context });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inertiajs/svelte",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "license": "MIT",
5
5
  "description": "The Svelte adapter for Inertia.js",
6
6
  "contributors": [
@@ -40,7 +40,7 @@
40
40
  "@sveltejs/kit": "^2.60.1",
41
41
  "@sveltejs/package": "^2.5.7",
42
42
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
43
- "axios": "^1.15.2",
43
+ "axios": "^1.17.0",
44
44
  "es-check": "9.5.3",
45
45
  "publint": "^0.3.17",
46
46
  "svelte": "^5.55.7",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "es-toolkit": "^1.33.0",
57
57
  "laravel-precognition": "^2.0.0",
58
- "@inertiajs/core": "3.2.0"
58
+ "@inertiajs/core": "3.3.1"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",