Skip to content

Commit

Permalink
Fix static array support in List, and add demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
wrnrlr committed Nov 17, 2024
1 parent f32db40 commit db15912
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/controlflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function List<T>(props:ListProps<T>) {
}
const mapper = indexes ? mapperWithIndexes : mapperWithoutIndexes
return memo(() => {
const newItems = list.call ? list() : []
const newItems = list.call ? list() : list
// (newItems)[$TRACK]; // top level tracking
return untrack(() => {
const temp = new Array(newItems.length) // new mapped array
Expand Down
15 changes: 15 additions & 0 deletions www/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<title>Demo</title>

<script type="module">

import {h,signal,effect,batch,wrap,render,onMount,List} from '../src/mod.ts'

function App() {
const fruits = ['apple', 'banana', 'cherry']
return h(List, {each:fruits}, f => f)
}

render(App, document.body)

</script>

0 comments on commit db15912

Please sign in to comment.