fix: refresh feed when switching channels
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$root = dirname(__DIR__, 2);
|
||||
$pageFile = $root . '/uniapp/src/pages/index/index.vue';
|
||||
$source = file_get_contents($pageFile);
|
||||
|
||||
$checks = [
|
||||
'首页维护资讯请求序号' => str_contains($source, 'let feedRequestId = 0'),
|
||||
'频道重载强制发起新请求' => str_contains($source, 'fetchFeedList(true)'),
|
||||
'强制请求不受旧 loading 状态阻塞' => str_contains($source, 'const fetchFeedList = async (force = false)'),
|
||||
'旧请求响应不会覆盖新频道' => str_contains($source, 'if (requestId !== feedRequestId) return'),
|
||||
'只有最新请求能够结束 loading' => str_contains($source, 'if (requestId === feedRequestId)'),
|
||||
];
|
||||
|
||||
foreach ($checks as $label => $passed) {
|
||||
if (!$passed) {
|
||||
fwrite(STDERR, "FAIL: {$label}\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "首页频道切换请求竞态静态检查通过\n";
|
||||
Reference in New Issue
Block a user