(post?: Post, { focus = true } = {})
| 527 | ?.focus({ preventScroll: true }); |
| 528 | |
| 529 | const select = (post?: Post, { focus = true } = {}) => { |
| 530 | if (!post) { |
| 531 | return; |
| 532 | } |
| 533 | |
| 534 | if (post.id !== currentId && window.scrollY > 0) { |
| 535 | // A new post starts at the top, as a new page does. |
| 536 | window.scrollTo(0, 0); |
| 537 | } |
| 538 | setSelectedId(post.id); |
| 539 | setSelectedPost(post); |
| 540 | if (post.id !== queryPostId) { |
| 541 | replaceQuery({ post: post.id }); |
| 542 | } |
| 543 | if (focus) { |
| 544 | focusRow(post.id); |
| 545 | } |
| 546 | }; |
| 547 | |
| 548 | // Taking the selected post out of the list moves the pane to its neighbor |
| 549 | const moveSelectionFrom = (post: Post) => { |
no test coverage detected