@solid-primitives/utils 5.2.0 → 5.2.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/dist/index.cjs +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ exports.asArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
29
29
|
exports.accessArray = (list) => list.map((v) => exports.access(v));
|
|
30
30
|
exports.withAccess = (value, fn) => {
|
|
31
31
|
const _value = exports.access(value);
|
|
32
|
-
typeof _value
|
|
32
|
+
typeof _value != null && fn(_value);
|
|
33
33
|
};
|
|
34
34
|
exports.asAccessor = (v) => typeof v === "function" ? v : () => v;
|
|
35
35
|
function accessWith(valueOrFn, ...args) {
|
|
@@ -157,9 +157,8 @@ function createHydrateSignal(serverValue, update, options) {
|
|
|
157
157
|
if (exports.isServer) {
|
|
158
158
|
return solidJs.createSignal(serverValue);
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
init && solidJs.onMount(() => setState(() => update()));
|
|
160
|
+
const [state, setState] = solidJs.createSignal(solidJs.sharedConfig.context ? serverValue : update(), options);
|
|
161
|
+
solidJs.sharedConfig.context && solidJs.onMount(() => setState(() => update()));
|
|
163
162
|
return [state, setState];
|
|
164
163
|
}
|
|
165
164
|
|
package/dist/index.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ declare function handleDiffArray<T>(current: readonly T[], prev: readonly T[], h
|
|
|
193
193
|
/**
|
|
194
194
|
* A signal object that handle hydration.
|
|
195
195
|
* @param serverValue initial value of the state on the server
|
|
196
|
-
* @param update called once on the client or on hydration to
|
|
196
|
+
* @param update called once on the client or on hydration to initialize the value
|
|
197
197
|
* @param options {@link SignalOptions}
|
|
198
198
|
* @returns
|
|
199
199
|
* ```ts
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var asArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
27
27
|
var accessArray = (list) => list.map((v) => access(v));
|
|
28
28
|
var withAccess = (value, fn) => {
|
|
29
29
|
const _value = access(value);
|
|
30
|
-
typeof _value
|
|
30
|
+
typeof _value != null && fn(_value);
|
|
31
31
|
};
|
|
32
32
|
var asAccessor = (v) => typeof v === "function" ? v : () => v;
|
|
33
33
|
function accessWith(valueOrFn, ...args) {
|
|
@@ -155,9 +155,8 @@ function createHydrateSignal(serverValue, update, options) {
|
|
|
155
155
|
if (isServer) {
|
|
156
156
|
return createSignal(serverValue);
|
|
157
157
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
init && onMount(() => setState(() => update()));
|
|
158
|
+
const [state, setState] = createSignal(sharedConfig.context ? serverValue : update(), options);
|
|
159
|
+
sharedConfig.context && onMount(() => setState(() => update()));
|
|
161
160
|
return [state, setState];
|
|
162
161
|
}
|
|
163
162
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solid-primitives/utils",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",
|
|
5
5
|
"author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",
|
|
6
6
|
"contributors": [
|