@revojs/vue 0.1.56 → 0.1.57

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Suspense>
2
+ <Suspense :key>
3
3
  <component :is="route" v-if="route" />
4
4
  </Suspense>
5
5
  </template>
@@ -10,12 +10,25 @@ import { isClient, Router, RouterContext, useUrl } from "revojs";
10
10
  import { computed, h, onErrorCaptured, onScopeDispose, shallowRef, type Component } from "vue";
11
11
  import { CLIENT_ERROR_CONTEXT, CLIENT_ROUTER_CONTEXT, NAVIGATE_HOOK, useScope } from "../client";
12
12
 
13
+ const router = new Router<Component>();
14
+
13
15
  const scope = useScope();
14
16
 
15
17
  const error = shallowRef<Error>();
16
18
  const context = shallowRef<RouterContext<Component>>();
17
19
 
18
- const router = new Router<Component>();
20
+ const key = computed(() => context.value?.segments.join("/"));
21
+
22
+ const route = computed(() => {
23
+ if (!context.value?.route) {
24
+ return;
25
+ }
26
+
27
+ return context.value.hooks.reduceRight(
28
+ (previous, hook) => h(hook, null, { default: () => (error.value === undefined ? previous : undefined) }),
29
+ h(context.value.route),
30
+ );
31
+ });
19
32
 
20
33
  for (const path in pages) {
21
34
  const segments = path.split("/");
@@ -33,20 +46,6 @@ for (const path in pages) {
33
46
  }
34
47
  }
35
48
 
36
- const route = computed(() => {
37
- if (context.value?.route) {
38
- const route = h(context.value.route);
39
-
40
- return context.value.hooks.reduceRight(
41
- (previous, hook) =>
42
- h(hook, null, {
43
- default: () => (error.value === undefined ? previous : undefined),
44
- }),
45
- route,
46
- );
47
- }
48
- });
49
-
50
49
  const fetch = () => {
51
50
  const next = useUrl(scope);
52
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revojs/vue",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "license": "MIT",
5
5
  "repository": "tellua/revojs",
6
6
  "files": [