@@ -2,10 +2,6 @@ import * as React from 'react';
22import type { StackConfig } from '../../interface' ;
33import useSizes from './useSizes' ;
44
5- export type NodePosition = {
6- y : number ;
7- } ;
8-
95/**
106 * Calculates each notification's position and the full list height.
117 */
@@ -20,7 +16,7 @@ export default function useListPosition(
2016 let offsetY = 0 ;
2117 let nextTotalHeight = 0 ;
2218 const stackThreshold = stack ?. threshold ?? 0 ;
23- const nextNotificationPosition = new Map < string , NodePosition > ( ) ;
19+ const nextNotificationPosition = new Map < string , number > ( ) ;
2420
2521 configList
2622 . slice ( )
@@ -29,18 +25,16 @@ export default function useListPosition(
2925 // Walk from newest to oldest so each notice can be positioned after the ones below it.
3026 const key = String ( config . key ) ;
3127 const height = sizeMap [ key ] ?. height ?? 0 ;
32- const nodePosition = {
33- y : stack && index > 0 ? offsetY + ( stack . offset ?? 0 ) - height : offsetY ,
34- } ;
28+ const y = stack && index > 0 ? offsetY + ( stack . offset ?? 0 ) - height : offsetY ;
3529
36- nextNotificationPosition . set ( key , nodePosition ) ;
30+ nextNotificationPosition . set ( key , y ) ;
3731
3832 if ( ! stack || index < stackThreshold ) {
39- nextTotalHeight = Math . max ( nextTotalHeight , nodePosition . y + height ) ;
33+ nextTotalHeight = Math . max ( nextTotalHeight , y + height ) ;
4034 }
4135
4236 if ( stack ) {
43- offsetY = nodePosition . y + height ;
37+ offsetY = y + height ;
4438 } else {
4539 offsetY += height + gap ;
4640 }
0 commit comments