Skip to content

Commit 25576d0

Browse files
committed
fix: get-os fixed to work in onMount (for SSR).
1 parent 61305f7 commit 25576d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bagon-hooks",
3-
"version": "0.0.0",
3+
"version": "0.0.1",
44
"description": "A collection of zero-dependency hooks for SolidJS forked directly from Mantine Hooks.",
55
"license": "MIT",
66
"author": "Carlo Taleon",

src/use-os/use-os.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Accessor, createEffect, createSignal } from 'solid-js';
1+
import { Accessor, createSignal, onMount } from 'solid-js';
22

33
export type OS = 'undetermined' | 'macos' | 'ios' | 'windows' | 'android' | 'linux';
44

@@ -71,7 +71,7 @@ interface UseOsOptions {
7171
export function useOs(options: UseOsOptions = { getValueInEffect: true }): Accessor<OS> {
7272
const [value, setValue] = createSignal<OS>(options.getValueInEffect ? 'undetermined' : getOS());
7373

74-
createEffect(() => {
74+
onMount(() => {
7575
if (options.getValueInEffect) {
7676
setValue(getOS);
7777
}

0 commit comments

Comments
 (0)