File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ declare module 'vscode' {
9595 */
9696 description ?: string | MarkdownString ;
9797
98+ /**
99+ * An optional badge that provides additional context about the chat session.
100+ */
101+ badge ?: string | MarkdownString ;
102+
98103 /**
99104 * An optional status indicating the current state of the session.
100105 */
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ const useMediaQuery = (query: string) => {
3030} ;
3131
3232const STICKY_THRESHOLD = 80 ;
33+ const STICKY_THRESHOLD_BUFFER = 10 ;
3334
3435export const Overview = ( pr : PullRequest ) => {
3536 const isSingleColumnLayout = useMediaQuery ( '(max-width: 768px)' ) ;
@@ -41,8 +42,15 @@ export const Overview = (pr: PullRequest) => {
4142 const handleScroll = ( ) => {
4243 if ( ! ticking ) {
4344 window . requestAnimationFrame ( ( ) => {
44- const scrolled = window . scrollY > STICKY_THRESHOLD ;
45- setIsSticky ( scrolled ) ;
45+ const scrollY = window . scrollY ;
46+ // Use hysteresis to prevent flickering at the threshold
47+ // When not sticky, activate when scrollY > threshold
48+ // When sticky, deactivate when scrollY < (threshold - buffer)
49+ if ( ! isSticky && scrollY > STICKY_THRESHOLD ) {
50+ setIsSticky ( true ) ;
51+ } else if ( isSticky && scrollY < STICKY_THRESHOLD - STICKY_THRESHOLD_BUFFER ) {
52+ setIsSticky ( false ) ;
53+ }
4654 ticking = false ;
4755 } ) ;
4856 ticking = true ;
@@ -51,7 +59,7 @@ export const Overview = (pr: PullRequest) => {
5159
5260 window . addEventListener ( 'scroll' , handleScroll , { passive : true } ) ;
5361 return ( ) => window . removeEventListener ( 'scroll' , handleScroll ) ;
54- } , [ ] ) ;
62+ } , [ isSticky ] ) ;
5563
5664 return < >
5765 < div id = "title" className = { `title ${ isSticky ? 'sticky' : '' } ` } >
You can’t perform that action at this time.
0 commit comments