-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
RTKQ tag invalidation not working in a complex Next app #4769
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
Comments
@Elieserlaguerre I've created this new issue based on your comment. Could you reply here with a link to either your real app Github repo, or a smaller example repo that shows this problem happening? |
I don't know how to share a link to my repo yet, but I did do some research on that and I found this: "fine-grained personal access tokens". it should give you temporary read-only access to my real app Github repo. if this is not what you're looking for then perhaps this then? https://github.com/Elieserlaguerre/synergistic-enterprises Empty root API file import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
// initialize an empty api service that we'll inject endpoints into later as needed
export const multiTenantApi = createApi({
reducerPath: "multiTenantApi",
baseQuery: fetchBaseQuery({ baseUrl: "/api" }),
endpoints: () => ({}),
tagTypes: ["user", "album", "mail", "session", "helpCenter", "agreements", "documents", "financialStatement", "income", "credit", "events", "pendingEvent", "private money loan", "loan tracker", "loan summary", "message summary", "event summary", "document summary", "report summary", "login", "subdomain", "parent company", "company search", "employee search", "partner search", "vendor search", "client form search", "company form search", "administration", "admin message"]
}); API endpoints for /finance subfolder import { multiTenantApi } from "./multiTenantApi";
export const financeApi = multiTenantApi.injectEndpoints({
overrideExisting: false,
endpoints: (build) => ({
guestMessage: build.mutation({
query: (payload) => ({
url: "/finance/contact-us/email/",
method: "POST",
body: payload
}),
transformErrorResponse: (results) => results?.data?.message,
invalidatesTags: [{ type: "mail" }, { type: "administration" }]
}),
createAppointments: build.mutation({
query: (formData) => ({
url: "/finance/contact-us/appointment",
method: "POST",
body: formData
}),
transformErrorResponse: (results) => results?.data?.message,
invalidatesTags: [{ type: "appointment" }, { type: "administration" }]
}),
// more endpoints...
})
});
export const {
// many hooks ...
} = financeApi; API endpoints for /admin subfolder import { multiTenantApi } from "./multiTenantApi";
export const adminApi = multiTenantApi.injectEndpoints({
overrideExisting: false,
endpoints: (build) => ({
getAdministration: build.query({
query: () => ({
url: "/admin/companies/administration",
method: "GET"
}),
providesTags: [{ type: "administration" }],
transformErrorResponse: (results) => results.data.message
}),
// more endpoints...
})
});
export const {
// many hooks...
} = adminApi; Redux Store Configuration file "use client";
import { configureStore } from "@reduxjs/toolkit";
import { setupListeners } from "@reduxjs/toolkit/query/react";
import userSlice from "../reducers/userSlice";
import storage from "redux-persist/lib/storage";
import { persistStore, persistReducer, FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER } from "redux-persist";
import viewMailSlice from "../reducers/viewMailSlice";
import privateMoneyLoanProgress from "../reducers/privateMoneyLoanProgress";
import businessLoanProgress from "../reducers/businessLoanProgress";
import { multiTenantApi } from "../data-fetching/multiTenantApi";
const persistedUserReducer = persistReducer({ key: "current-user", storage }, userSlice);
const persistedPrivateMoneyStatus = persistReducer({ key: "private-money-application-pregress", storage }, privateMoneyLoanProgress);
const persistedBusinessLoanStatus = persistReducer({ key: "business-loan-application-progress", storage }, businessLoanProgress);
const persistMessageSlice = persistReducer({ key: "view-message", storage }, viewMailSlice);
const store = configureStore({
reducer: {
user: persistedUserReducer,
privateMoneyProgress: persistedPrivateMoneyStatus,
businessLoanProgress: persistedBusinessLoanStatus,
viewMail: persistMessageSlice,
[multiTenantApi.reducerPath]: multiTenantApi.reducer
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
ignoreActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
}
}).concat(multiTenantApi.middleware) //RTK Query setup
});
export const persistor = persistStore(store);
setupListeners(store.dispatch); //RTK Querry
export default store; |
@Elieserlaguerre yeah, the repo URL ( https://github.com/Elieserlaguerre/synergistic-enterprises ) is what I was asking for. That said: Please don't paste Github access tokens in a public place! Anyone could use them! |
okay, thanks for letting me, this was my first time trying to share a link so I wasn't sure how to go about it. |
It does look like that repo is private. The best way you can give me access is:
|
I've sent you the invitation. |
Discussed externally - ultimately it's an architectural issue. |
Originally posted by @Elieserlaguerre in #3692
The text was updated successfully, but these errors were encountered: