MCPcopy Create free account
hub / github.com/dailydotdev/apps / onPaneChange

Function onPaneChange

packages/shared/src/components/BookmarkFeedLayout.tsx:575–599  ·  view source on GitHub ↗
(post: Post)

Source from the content-addressed store, hash-verified

573 // the pane's copy stays the selection once an action takes the row out of
574 // the list (read in the Unread view, say).
575 const onPaneChange = (post: Post) => {
576 if (post.id === selectedId) {
577 setSelectedPost(post);
578 }
579
580 const item = findItem(post.id);
581 if (!item) {
582 return;
583 }
584
585 if (post.bookmarked === false) {
586 moveSelectionFrom(post);
587 removePost(item.page, item.index);
588 return;
589 }
590
591 updatePost(item.page, item.index, {
592 ...item.post,
593 read: post.read ?? item.post.read,
594 numUpvotes: post.numUpvotes ?? item.post.numUpvotes,
595 numComments: post.numComments ?? item.post.numComments,
596 userState: post.userState ?? item.post.userState,
597 bookmark: post.bookmark ?? item.post.bookmark,
598 });
599 };
600
601 const onKeyDown = (event: KeyboardEvent<HTMLElement>, post: Post) => {
602 if (event.metaKey || event.ctrlKey || event.altKey) {

Callers

nothing calls this directly

Calls 2

moveSelectionFromFunction · 0.85
updatePostFunction · 0.50

Tested by

no test coverage detected