Skip to content

Commit

Permalink
Comment (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed May 13, 2024
1 parent 90df38d commit 8033056
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/jsapi-components/src/useViewportData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ export function useViewportData<TItem, TTable extends dh.Table | dh.TreeTable>({
const dh = useApi();

// Store the memoized callback in a ref so that changes to `viewportData`
// don't invalidate the memoization of `onTableUpdated`. This avoids
// `useTableListener` from re-subscribing to the same event over and over.
// don't invalidate the memoization of `onTableUpdated`. This prevents
// `useTableListener` from unnecessarily re-subscribing to the same event over
// and over.
const onTableUpdatedRef = useRef<(event: OnTableUpdatedEvent) => void>();
onTableUpdatedRef.current = useMemo(
() => createOnTableUpdatedHandler(viewportData, deserializeRow),
Expand Down

0 comments on commit 8033056

Please sign in to comment.