From 333b67a5055f8654b3b53a39fb06dec9ef3a10bc Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:03:18 +0200 Subject: [PATCH] 964: Removed caching from redux toolkit api --- CHANGELOG.md | 2 ++ src/redux/api/api.generated.ts | 1 + src/redux/api/package.json | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88f13833..be518d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- [#240](https://github.com/os2display/display-admin-client/pull/240) + - Remove caching of requests from redux toolkit api. - [#239](https://github.com/os2display/display-admin-client/pull/239) - Updated api integration following route change to v2. - [#238](https://github.com/os2display/display-admin-client/pull/238) diff --git a/src/redux/api/api.generated.ts b/src/redux/api/api.generated.ts index 10da2fb5..f473b908 100644 --- a/src/redux/api/api.generated.ts +++ b/src/redux/api/api.generated.ts @@ -2,6 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query/react"; import extendedBaseQuery from "../dynamic-base-query"; export const api = createApi({ baseQuery: extendedBaseQuery, + keepUnusedDataFor: 0, tagTypes: [], endpoints: (build) => ({ getOidcAuthTokenItem: build.query< diff --git a/src/redux/api/package.json b/src/redux/api/package.json index f29fed91..f4c66c23 100644 --- a/src/redux/api/package.json +++ b/src/redux/api/package.json @@ -6,7 +6,7 @@ "scripts": { "generate": "npx @rtk-incubator/rtk-query-codegen-openapi --hooks api.json > api.generated.ts", "//": "# Therefore we replace into a temporary file which is then renamed to the original file", - "replace": "sed 's/import { fetchBaseQuery } from .*;/import extendedBaseQuery from \"..\\/dynamic-base-query\";/g;s/baseQuery: fetchBaseQuery.*,/baseQuery: extendedBaseQuery,/g' api.generated.ts > api.generated.ts.patched && mv api.generated.ts.patched api.generated.ts", + "replace": "sed 's/import { fetchBaseQuery } from .*;/import extendedBaseQuery from \"..\\/dynamic-base-query\";/g;s/baseQuery: fetchBaseQuery.*,/baseQuery: extendedBaseQuery,\\n keepUnusedDataFor: 0,/g' api.generated.ts > api.generated.ts.patched && mv api.generated.ts.patched api.generated.ts", "compile": "node_modules/typescript/bin/tsc api.generated.ts", "start": "npm run generate && npm run replace" },