diff --git a/src/core/containerObserver.ts b/src/core/containerObserver.ts index f6e69dbe..f4ece031 100644 --- a/src/core/containerObserver.ts +++ b/src/core/containerObserver.ts @@ -220,6 +220,6 @@ export function createContainerObserver( toasts.get(id)!.toggle = fn; }, isToastActive: (id: Id) => activeToasts.some(v => v === id), - getSnapshot: () => (props.newestOnTop ? snapshot.reverse() : snapshot) + getSnapshot: () => snapshot }; } diff --git a/src/hooks/useToastContainer.ts b/src/hooks/useToastContainer.ts index 22c5db83..54c78f91 100644 --- a/src/hooks/useToastContainer.ts +++ b/src/hooks/useToastContainer.ts @@ -16,6 +16,10 @@ export function useToastContainer(props: ToastContainerProps) { const toRender = new Map(); + if (props.newestOnTop) { + snapshot.reverse(); + } + snapshot.forEach(toast => { const { position } = toast.props; toRender.has(position) || toRender.set(position, []);