alovajs / alova

Workflow-Streamlined next-generation request tools. Extremely streamline API integration workflow, just one step
https://alova.js.org
MIT License
2.97k stars 109 forks source link

fix: cannot force send in restore mode in hooks #451

Closed MeetinaXD closed 4 months ago

MeetinaXD commented 4 months ago

相关 Issue / Related Issue

close #449

这个 PR 是什么类型?/ What type of PR is this?

这个 PR 做了什么?/ What does this PR do?

fix: cannot force send in restore mode in hooks

文档 / Docs

相关代码:src/functions/sendRequest.ts#L121

强制请求时,cache 不会被读取,因此为 undefined

如上述代码所示,在 restore 模式下只要 cache 为空,就尝试从持久化数据中恢复 cache。 这导致命中 cache ,认为本次请求无需发出。

PR 添加了判断条件,在 force == true 时始终不从持久化中恢复;并添加了一个针对 restore 和 force 请求的测试。

测试 / Testing

ALL tests passed.

image
changeset-bot[bot] commented 4 months ago

⚠️ No Changeset found

Latest commit: cdd0fb4ef9ff71e8d5ee5f65f0e4c065e4ec11c4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

JOU-amjs commented 4 months ago

:tada: This PR is included in version 2.21.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: