// import componentsReducer from "@/redux/currentApp/editor/components/componentsSlice"
import { ListenerEffectAPI, TypedStartListening, configureStore, createListenerMiddleware } from "@reduxjs/toolkit"
import { appReducer } from "./redux/currentApp/slice"
import configReducer from "@/redux/config/configSlice"
// import componentsSlice from "./redux/currentApp/components/componentsSlice"
const listenerMiddleware = createListenerMiddleware()
const store = configureStore({
  reducer: {
    // components:componentsSlice,
    config: configReducer,
    currentApp: appReducer,
    //   dashboard: dashboardReducer,
    //   currentUser: currentUserReducer,
    //   liveFamily: liveFamilyReducer,
    //   builderInfo: builderInfoReducer,
    //   resource: resourceReducer,
    //   team: teamReducer,
  },
  devTools:true,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware(
    //   {
    //   serializableCheck: {
    //     ignoredActions: ["execution/setExecutionResultReducer"],
    //   },
    // }
    ).prepend(listenerMiddleware.middleware)
})

export default store
export type RootState = ReturnType<typeof store.getState>

export type AppDispatch = typeof store.dispatch

export type AppStartListening = TypedStartListening<RootState, AppDispatch>

export type AppListenerEffectAPI = ListenerEffectAPI<RootState, AppDispatch>

export const startAppListening =
  listenerMiddleware.startListening as AppStartListening