Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions redisinsight/ui/src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { BrowserRouter } from 'react-router-dom'
import { Router as ReactRouter } from 'react-router-dom'
import { createBrowserHistory } from 'history'

interface Props {
children: React.ReactElement
Expand All @@ -13,8 +14,10 @@ if (RIPROXYPATH !== '') {
MOUNT_PATH = RIPROXYPATH
}

export const history = createBrowserHistory({ basename: MOUNT_PATH })

const Router = ({ children }: Props) => (
<BrowserRouter basename={MOUNT_PATH}>{children}</BrowserRouter>
<ReactRouter history={history}>{children}</ReactRouter>
)

export default Router
7 changes: 3 additions & 4 deletions redisinsight/ui/src/slices/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createBrowserHistory } from 'history'
import { configureStore, combineReducers } from '@reduxjs/toolkit'

import { getConfig } from 'uiSrc/config'
Expand Down Expand Up @@ -59,8 +58,6 @@ import tagsReducer from './instances/tags'

const riConfig = getConfig()

export const history = createBrowserHistory()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was not used and also it creates another instance - not the one from BrowserRouter, so it's also useless


export const rootReducer = combineReducers({
app: combineReducers({
info: appInfoReducer,
Expand Down Expand Up @@ -149,7 +146,9 @@ const store = configureStore({
devTools: riConfig.app.env !== 'production',
})

export { store }
const dispatch = store.dispatch

export { store, dispatch }

export type ReduxStore = typeof store
export type RootState = ReturnType<typeof rootReducer>
Expand Down
3 changes: 0 additions & 3 deletions redisinsight/ui/src/utils/test-store.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { createBrowserHistory } from 'history'

import type { ReduxStore } from 'uiSrc/slices/store'

// Re-export all types and exports from the real store to avoid circular dependencies during tests

export type { RootState, AppDispatch, ReduxStore } from 'uiSrc/slices/store'
export const history = createBrowserHistory()

// Lazy reference to avoid circular dependencies
// The store will be set by the store module itself after it's created
Expand Down
Loading