-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Possible issues blocking upgrades to 2.0 #3921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milestone
Comments
GrafanaUnexpected Issues
// public/test/core/redux/reduxTester.ts
export const reduxTester = <State>(args?: ReduxTesterArguments<State>): ReduxTesterGiven<State> => {
const dispatchedActions: UnknownAction[] = [];
const logActionsMiddleWare: Middleware<{}, Partial<StoreState>> =
(store: MiddlewareAPI<Dispatch, Partial<StoreState>>) => (next) => (action) => {
// filter out thunk actions
if (action && typeof action !== 'function') {
dispatchedActions.push(action);
}
return next(action);
};
const preloadedState = args?.preloadedState ?? ({} as unknown as Partial<State>);
const debug = args?.debug ?? false;
let store: EnhancedStore<State, UnknownAction, []> | null = null;
// const defaultMiddleware = getDefaultMiddleware<State>({
// thunk: false,
// serializableCheck: false,
// immutableCheck: false,
// } as any);
const givenRootReducer = (rootReducer: Reducer<State>): ReduxTesterWhen<State> => {
store = configureStore({
reducer: rootReducer,
// middleware: [...defaultMiddleware, logActionsMiddleWare, thunk] as unknown as [ThunkMiddleware<State>],
middleware: (gDM) => {
return gDM().concat(logActionsMiddleWare);
},
preloadedState,
});
setStore(store as any);
return instance;
}; Other Issues
const alertmanagerDatasources = useSelector(
createSelector(
(state: StoreState) => state.dataSources.dataSources.filter((ds) => ds.type === 'alertmanager'),
(datasources) => keyBy(datasources, (ds) => ds.uid)
)
);
export function usePageNav(navId?: string, oldProp?: NavModel): NavModel | undefined {
if (oldProp) {
return oldProp;
}
if (!navId) {
return;
}
// Page component is used in so many tests, this simplifies not having to initialize a full redux store
if (!store) {
return;
}
// eslint-disable-next-line react-hooks/rules-of-hooks
return useSelector(createSelector(getNavIndex, (navIndex) => getNavModel(navIndex, navId ?? 'home')));
} or this one: export const isLeftPaneSelector = (exploreId: string) =>
createSelector(selectPanes, (panes) => {
return Object.keys(panes)[0] === exploreId;
});
// other file entirely
const isLeftPane = useSelector(isLeftPaneSelector(exploreId)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Playing with some real-world repos using RTK and TS, to see what happens if I try to upgrade to a local
2.0-rc
+ build.InvokeAI
Expected Issues
EntityState<T>
errors because it needs the second<Type, Id>
genericmemoizeOptions: {equalityCheck}
Unexpected Issues
Listener inferred type wasThis is actually expected behavior per TS Bug found while testing the 2.0.0-beta.4 #3862 - TS has done this for a while, we now just infer asUnknownAction
, but worked okay when theisAnyOf()
was moved outsideUnknownAction
instead ofAnyAction
:Apparently we need to haveconfigureStore()
has TS errors whenenhancers
is provided, andmiddleware
returns more than one middleware entry in the tuple. (Something about a tuple size mismatch, maybe? https://stackoverflow.com/questions/64308563/source-has-x-elements-but-target-allows-only-1 )middleware
declared beforeconfigureStore
, so that we can infer the type ofgetDefaultEnhancers
correctly. 🧙The text was updated successfully, but these errors were encountered: