Open
Description
需求描述 Feature Description
如果一个地方的加载跟两个 连续request有关, request1 成功后立刻发起request2.
由于request2 的防抖 导致 request2的loading有延迟, 导致两个loading 不连续。
建议的解决方案 Proposed Solution
debounce 等待过程中能否把loading先设置为true 或者有另一个值来表示(比如preLoading)。
其他信息 Other information
<div v-if="loading1 || loading2">loading...</div>
<div v-else>content</div>
const { loading: loading2, run } = useRequest(server2);
const { loading: loading1 } = useRequest(server1, {
manual: false,
onSuccess(res) {
run(res);
},
});
页面会经过会loading... => content => loading... => content。
虽然 debounceOptions: {leading: true} 可以解决问题, 但实际场景中 这与防抖的初衷不相符