vike-solid 0.7.3-commit-704e0a7 → 0.7.3-commit-3fa1f95
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/dist/hooks/useData.js +9 -4
- package/package.json +6 -6
package/dist/hooks/useData.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { createStore } from 'solid-js/store';
|
|
2
|
+
import { createEffect } from 'solid-js';
|
|
1
3
|
import { usePageContext } from './usePageContext.js';
|
|
2
4
|
import 'solid-js/web';
|
|
3
|
-
import 'solid-js';
|
|
4
5
|
|
|
5
6
|
/** Access `pageContext.data` from any SolidJS component
|
|
6
7
|
*
|
|
@@ -9,9 +10,13 @@ import 'solid-js';
|
|
|
9
10
|
* - https://vike.dev/pageContext-anywhere
|
|
10
11
|
*/
|
|
11
12
|
function useData() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const ctx = usePageContext();
|
|
14
|
+
|
|
15
|
+
// sub store to keep reactivity https://github.com/vikejs/vike-solid/issues/114
|
|
16
|
+
const [data, setData] = createStore(ctx.data);
|
|
17
|
+
createEffect(() => {
|
|
18
|
+
setData(ctx.data);
|
|
19
|
+
});
|
|
15
20
|
return data;
|
|
16
21
|
}
|
|
17
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike-solid",
|
|
3
|
-
"version": "0.7.3-commit-
|
|
3
|
+
"version": "0.7.3-commit-3fa1f95",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "rollup -c rollup.config.js --watch",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"solid-js": "^1.8.7",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"vike": ">=0.4.191",
|
|
19
|
+
"vite": ">=5.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@babel/core": "^7.25.2",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"@rollup/plugin-babel": "^6.0.4",
|
|
27
27
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
28
28
|
"@types/node": "^22.4.0",
|
|
29
|
-
"babel-preset-solid": "^1.8.
|
|
29
|
+
"babel-preset-solid": "^1.8.22",
|
|
30
30
|
"bumpp": "^9.5.2",
|
|
31
|
-
"rollup": "^4.21.
|
|
31
|
+
"rollup": "^4.21.2",
|
|
32
32
|
"rollup-plugin-dts": "^6.1.1",
|
|
33
|
-
"solid-js": "^1.8.
|
|
33
|
+
"solid-js": "^1.8.22",
|
|
34
34
|
"tslib": "^2.7.0",
|
|
35
35
|
"typescript": "^5.5.4",
|
|
36
36
|
"vike": "^0.4.193",
|