mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 14:04:21 +01:00
fix: stop caching popup
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { createMemo, children } from 'solid-js';
|
import { createMemo } from 'solid-js';
|
||||||
|
|
||||||
import { Picker } from 'emoji-mart';
|
import { Picker } from 'emoji-mart';
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ const useEmojiPicker = (propsProvider: () => UseEmojiPickerProps) => {
|
|||||||
|
|
||||||
let popup: UsePopup | undefined;
|
let popup: UsePopup | undefined;
|
||||||
|
|
||||||
const pickerElement = children(() => {
|
const pickerElement = () => {
|
||||||
const customEmojis = Object.entries(config().customEmojis).map(([name, { url }]) => ({
|
const customEmojis = Object.entries(config().customEmojis).map(([name, { url }]) => ({
|
||||||
id: name,
|
id: name,
|
||||||
name,
|
name,
|
||||||
@@ -66,7 +66,7 @@ const useEmojiPicker = (propsProvider: () => UseEmojiPickerProps) => {
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
return picker as any as HTMLElement;
|
return picker as any as HTMLElement;
|
||||||
});
|
};
|
||||||
|
|
||||||
popup = usePopup(() => ({
|
popup = usePopup(() => ({
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
import {
|
import { createSignal, createEffect, createMemo, onCleanup, Show, type JSX } from 'solid-js';
|
||||||
createSignal,
|
|
||||||
createEffect,
|
|
||||||
createMemo,
|
|
||||||
onCleanup,
|
|
||||||
children,
|
|
||||||
Show,
|
|
||||||
type JSX,
|
|
||||||
} from 'solid-js';
|
|
||||||
|
|
||||||
import { Portal } from 'solid-js/web';
|
import { Portal } from 'solid-js/web';
|
||||||
|
|
||||||
@@ -31,13 +23,13 @@ const usePopup = (propsProvider: () => UsePopupProps): UsePopup => {
|
|||||||
const [style, setStyle] = createSignal<JSX.CSSProperties>({});
|
const [style, setStyle] = createSignal<JSX.CSSProperties>({});
|
||||||
const [isOpen, setIsOpen] = createSignal(false);
|
const [isOpen, setIsOpen] = createSignal(false);
|
||||||
|
|
||||||
const resolvedChildren = children(() => {
|
const resolvedChildren = () => {
|
||||||
const { popup } = props();
|
const { popup } = props();
|
||||||
if (typeof popup === 'function') {
|
if (typeof popup === 'function') {
|
||||||
return popup();
|
return popup();
|
||||||
}
|
}
|
||||||
return popup;
|
return popup;
|
||||||
});
|
};
|
||||||
|
|
||||||
const open = () => setIsOpen(true);
|
const open = () => setIsOpen(true);
|
||||||
const close = () => setIsOpen(false);
|
const close = () => setIsOpen(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user