fix: move CartSnackbar inside BrowserRouter in App.tsx

This commit is contained in:
Kirill
2026-05-25 18:27:26 +05:00
parent bedf98245b
commit bd8722cfcb
6 changed files with 43 additions and 152 deletions
+2
View File
@@ -1,6 +1,7 @@
import { BrowserRouter } from 'react-router-dom'
import { AppProviders } from '@/app/providers/AppProviders'
import { AppRoutes } from '@/app/routes'
import { CartSnackbar } from '@/shared/ui/CartSnackbar'
import { ErrorBoundary } from '@/shared/ui/ErrorBoundary'
export function App() {
@@ -10,6 +11,7 @@ export function App() {
<ErrorBoundary>
<AppRoutes />
</ErrorBoundary>
<CartSnackbar />
</BrowserRouter>
</AppProviders>
)
+1 -5
View File
@@ -3,7 +3,6 @@ import CssBaseline from '@mui/material/CssBaseline'
import { ThemeProvider, createTheme } from '@mui/material/styles'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ThemeControllerProvider, useThemeController } from '@/app/providers/theme-controller'
import { CartSnackbar } from '@/shared/ui/CartSnackbar'
import { SseProvider } from './SseProvider'
function AppThemeInner({ children }: PropsWithChildren) {
@@ -189,10 +188,7 @@ export function AppProviders({ children }: PropsWithChildren) {
<QueryClientProvider client={queryClient}>
<SseProvider />
<ThemeControllerProvider>
<AppThemeInner>
{children}
<CartSnackbar />
</AppThemeInner>
<AppThemeInner>{children}</AppThemeInner>
</ThemeControllerProvider>
</QueryClientProvider>
)
@@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { render, screen, fireEvent } from '@testing-library/react'
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import * as notifications from '@/shared/model/cart-notifications'
import { AddToCartButton } from '../AddToCartButton'
@@ -1,9 +1,9 @@
import { render, screen, fireEvent } from '@testing-library/react'
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { render, screen, fireEvent } from '@testing-library/react'
import { MemoryRouter } from 'react-router-dom'
import * as notifications from '@/shared/model/cart-notifications'
import { describe, it, expect, vi, beforeEach } from 'vitest'
import * as api from '@/entities/cart/api/cart-api'
import * as notifications from '@/shared/model/cart-notifications'
import { ToggleCartIcon } from '../ToggleCartIcon'
vi.mock('@/entities/cart/api/cart-api', () => ({