fix: Add cache fix for request Usage

Added cache: 'no-store' parameter to fetch to avoid caching issue in non-Vercel deployment environment(ref: https://beta.nextjs.org/docs/data-fetching/fetching#dynamic-data-fetching)
This commit is contained in:
ガオガオ
2023-04-13 01:27:11 +08:00
parent 8da581695f
commit d2ee1bd212
4 changed files with 20 additions and 8 deletions

View File

@@ -193,7 +193,7 @@ export function Settings(props: { closeSettings: () => void }) {
const remoteId = updateStore.remoteVersion;
const hasNewVersion = currentVersion !== remoteId;
function checkUpdate(force = false) {
function checkUpdate(force: boolean = false) {
setCheckingUpdate(true);
updateStore.getLatestVersion(force).then(() => {
setCheckingUpdate(false);
@@ -205,9 +205,9 @@ export function Settings(props: { closeSettings: () => void }) {
subscription: updateStore.subscription,
};
const [loadingUsage, setLoadingUsage] = useState(false);
function checkUsage() {
function checkUsage(force: boolean = false) {
setLoadingUsage(true);
updateStore.updateUsage().finally(() => {
updateStore.updateUsage(true).finally(() => {
setLoadingUsage(false);
});
}
@@ -499,7 +499,9 @@ export function Settings(props: { closeSettings: () => void }) {
<IconButton
icon={<ResetIcon></ResetIcon>}
text={Locale.Settings.Usage.Check}
onClick={checkUsage}
onClick={() => {
checkUsage(true);
}}
/>
)}
</SettingItem>