mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 22:14:26 +01:00
fix: use createRoot for signals outside components
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createSignal, createMemo, onMount, type Signal, onCleanup } from 'solid-js';
|
||||
import { createRoot, createSignal, createMemo, onMount, type Signal, onCleanup } from 'solid-js';
|
||||
|
||||
export type UseRequestMessageProps = {
|
||||
id: string;
|
||||
@@ -19,7 +19,9 @@ export type MessageChannelResponse<T> =
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
| { requestId: string; ok: false; error: any };
|
||||
|
||||
const [channels, setChannels]: Signal<Record<string, MessageChannel>> = createSignal({});
|
||||
const [channels, setChannels]: Signal<Record<string, MessageChannel>> = createRoot(() =>
|
||||
createSignal({}),
|
||||
);
|
||||
|
||||
const registerChannelIfNotExist = (id: string) => {
|
||||
if (channels()[id] == null) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createSignal } from 'solid-js';
|
||||
import { createRoot, createSignal } from 'solid-js';
|
||||
|
||||
type ModalState =
|
||||
| { type: 'Login' }
|
||||
@@ -9,7 +9,7 @@ type ModalState =
|
||||
| { type: 'About' }
|
||||
| { type: 'Closed' };
|
||||
|
||||
const [modalState, setModalState] = createSignal<ModalState>({ type: 'Closed' });
|
||||
const [modalState, setModalState] = createRoot(() => createSignal<ModalState>({ type: 'Closed' }));
|
||||
|
||||
const useModalState = () => {
|
||||
const showLogin = () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import '@/types/nostr.d';
|
||||
import { createSignal, onMount, type Accessor } from 'solid-js';
|
||||
import { createRoot, createSignal, onMount, type Accessor } from 'solid-js';
|
||||
|
||||
let asking = false;
|
||||
const [pubkey, setPubkey] = createSignal<string | undefined>(undefined);
|
||||
const [pubkey, setPubkey] = createRoot(() => createSignal<string | undefined>(undefined));
|
||||
|
||||
// TODO 失敗したときに通知等を表示したい
|
||||
const usePubkey = (): Accessor<string | undefined> => {
|
||||
|
||||
Reference in New Issue
Block a user