Skip to content

Commit

Permalink
fixed solid reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
imascha committed Apr 3, 2024
1 parent f43016a commit 3d8232c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/solid/RangedFor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
untrack,
JSX,
Signal,
Accessor,
} from "solid-js";
import { ItemsRange } from "../core/types";

Expand All @@ -27,7 +28,7 @@ interface RenderedNode<T> {
export const RangedFor = <T,>(props: {
_each: T[];
_range: ItemsRange;
_render: (data: T, index: number) => JSX.Element;
_render: (data: Accessor<T>, index: number) => JSX.Element;
}): JSX.Element => {
let prev = new Map<number, RenderedNode<T>>();

Expand All @@ -52,7 +53,7 @@ export const RangedFor = <T,>(props: {
? lookup._element
: createRoot((dispose) => {
const data = createSignal(newData);
const result = props._render(data[0](), i);
const result = props._render(data[0], i);
current.set(i, {
_data: data,
_element: result,
Expand Down
2 changes: 1 addition & 1 deletion src/solid/Virtualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const Virtualizer = <T,>(props: VirtualizerProps<T>): JSX.Element => {
_resizer={resizer._observeItem}
_offset={offset()}
_hide={hide()}
_children={props.children(data, index)}
_children={props.children(data(), index)}
_isHorizontal={horizontal}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/solid/WindowVirtualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const WindowVirtualizer = <T,>(
_resizer={resizer._observeItem}
_offset={offset()}
_hide={hide()}
_children={props.children(data, index)}
_children={props.children(data(), index)}
_isHorizontal={horizontal}
/>
);
Expand Down

0 comments on commit 3d8232c

Please # to comment.