Skip to content

Commit

Permalink
fix: use keyed rendering for TrackLoop component
Browse files Browse the repository at this point in the history
  • Loading branch information
insertish committed Mar 30, 2024
1 parent 1dc7008 commit 1e70c78
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/TrackLoop.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// @livekit/components-react@2.0.4
// Apache-2.0

import type { TrackReference, TrackReferenceOrPlaceholder } from '@livekit/components-core'
import {
getTrackReferenceId,
type TrackReference,
type TrackReferenceOrPlaceholder,
} from '@livekit/components-core'
import { TrackRefContext } from '../context/track-reference-context'
import { Accessor, Component, For } from 'solid-js'
import { Accessor, Component } from 'solid-js'
import { Key } from '@solid-primitives/keyed'

Check failure on line 11 in src/components/TrackLoop.tsx

View workflow job for this annotation

GitHub Actions / build

Cannot find module '@solid-primitives/keyed' or its corresponding type declarations.

/** @public */
export interface TrackLoopProps {
Expand All @@ -30,12 +35,12 @@ export interface TrackLoopProps {
*/
export function TrackLoop({ tracks, ...props }: TrackLoopProps) {
return (
<For each={tracks()}>
<Key each={tracks()} by={item => getTrackReferenceId(item)}>

Check failure on line 38 in src/components/TrackLoop.tsx

View workflow job for this annotation

GitHub Actions / build

Parameter 'item' implicitly has an 'any' type.
{trackReference => (

Check failure on line 39 in src/components/TrackLoop.tsx

View workflow job for this annotation

GitHub Actions / build

Parameter 'trackReference' implicitly has an 'any' type.
<TrackRefContext.Provider value={trackReference}>
<TrackRefContext.Provider value={trackReference()}>
{props.children({})}
</TrackRefContext.Provider>
)}
</For>
</Key>
)
}

0 comments on commit 1e70c78

Please sign in to comment.