Skip to content

Commit

Permalink
fix(web): properly convert map to array
Browse files Browse the repository at this point in the history
  • Loading branch information
zobweyt committed Jan 5, 2025
1 parent 8fb47fe commit fe9898f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const CategoriesRadioGroup = (props: CategoriesRadioGroupProps) => {
orientation="horizontal"
class="border-bg-secondary flex flex-row justify-between border-t p-1"
>
<For each={context.categories.keys().toArray()}>
<For each={Array.from(context.categories.keys())}>
{(category) => <CategoriesRadioGroupItem value={category} />}
</For>
</RadioGroup>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/emoji-picker/EmojisRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const EmojisRadioGroup = (props: EmojisRadioGroupProps) => {
const [virtualizerHandle, setVirtualizerHandle] = createSignal<VirtualizerHandle>();

const onScroll = (offset: number): void => {
context.setCategory(() => context.currentCategory(offset));
context.setCategory(context.currentCategory(offset));
};

createEffect(() => {
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/components/emoji-picker/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export const EmojiPickerRoot: Component<EmojiPickerProps> = (props) => {
});

const currentCategory = (offset: number): number | undefined => {
return categories
.entries()
.toArray()
return Array.from(categories.entries())
.reverse()
.find(([_group, index]) => offset >= (virtualizerHandle()?.getItemOffset(index) || 0))?.[0];
};
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/emoji-picker/context.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ReactiveMap } from "@solid-primitives/map";
import type { Emoji } from "emojibase";
import { createContext, useContext, type Accessor, type Setter } from "solid-js";
import type { VirtualizerHandle } from "virtua/solid";
import type { EmojiWithIndex } from "./types";
import type { Emoji } from "emojibase";

export type EmojiPickerContextValue = {
emoji: Accessor<Emoji | undefined>;
Expand Down

0 comments on commit fe9898f

Please sign in to comment.