inertiax-svelte 2.5.1 → 2.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertiax-svelte",
3
- "version": "2.5.1",
3
+ "version": "2.6.1",
4
4
  "license": "MIT",
5
5
  "description": "The Svelte adapter for Inertia.js",
6
6
  "contributors": [
package/src/Frame.svelte CHANGED
@@ -3,14 +3,16 @@
3
3
  import Render, { h } from './Render.svelte'
4
4
  import store from './store'
5
5
  import { router } from 'inertiax-svelte'
6
-
6
+
7
7
  const {children, src, hint, component, id = Math.random(), ...restProps} = $props()
8
-
8
+
9
9
  setContext('inertia:frame-id', id)
10
10
 
11
11
  const components = $derived($store.frames?.[id] && h($store.frames[id].component.default, Object.assign({}, restProps, $store.frames[id].props)))
12
-
12
+
13
13
  onMount(() => {
14
+ // we already have components (probably from history navigation), don't need to make a request
15
+ if (components) return;
14
16
  router.visit(src, {
15
17
  target: id,
16
18
  hint,
package/src/useForm.js CHANGED
@@ -100,6 +100,7 @@ function useForm(...args) {
100
100
  ...options,
101
101
  headers: {
102
102
  'X-Inertia-Frame-Src': frameSrc,
103
+ 'X-Inertia': true,
103
104
  },
104
105
  target: typeof(options.target) !== 'undefined' ? options.target : frameId,
105
106
  onCancelToken: (token) => {