Remove no-op voids and add explicit SW return
Remove a pointless `void options.callbackTimeout;` no-op in napcat-rpc client. In the service worker template, add `/* eslint-disable no-undef */` and an explicit `return undefined;` in the cache cleanup callback to make the return value explicit and satisfy linters. In the OneBot debug UI, call `sendRequest(value)` without the leading `void` so the returned promise is not intentionally ignored.
This commit is contained in:
1 parent
b15d02535e
commit
4ed4dfd450
3 files changed
+3
-2
No files matched your search
@@ -31,7 +31,6 @@ export function createDeepProxy<T = unknown> (options: DeepProxyOptions): T {
|
|||||||
refId: rootRefId,
|
refId: rootRefId,
|
||||||
// callbackTimeout 可供未来扩展使用
|
// callbackTimeout 可供未来扩展使用
|
||||||
} = options;
|
} = options;
|
||||||
void options.callbackTimeout;
|
|
||||||
|
|
||||||
const callbackRegistry = new SimpleCallbackRegistry();
|
const callbackRegistry = new SimpleCallbackRegistry();
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
/**
|
/**
|
||||||
* NapCat WebUI Service Worker
|
* NapCat WebUI Service Worker
|
||||||
*
|
*
|
||||||
@@ -157,6 +158,7 @@ self.addEventListener('activate', (event) => {
|
|||||||
console.log('[SW] Deleting old cache:', cacheName);
|
console.log('[SW] Deleting old cache:', cacheName);
|
||||||
return caches.delete(cacheName);
|
return caches.delete(cacheName);
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
// 立即接管所有客户端
|
// 立即接管所有客户端
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ const OneBotApiDebug = forwardRef<OneBotApiDebugRef, OneBotApiDebugProps>((props
|
|||||||
setActiveTab('request');
|
setActiveTab('request');
|
||||||
setRequestBody(value);
|
setRequestBody(value);
|
||||||
// 直接用 override 发送,避免 setState 异步导致拿到旧值
|
// 直接用 override 发送,避免 setState 异步导致拿到旧值
|
||||||
void sendRequest(value);
|
sendRequest(value);
|
||||||
},
|
},
|
||||||
focusRequestEditor: () => {
|
focusRequestEditor: () => {
|
||||||
setActiveTab('request');
|
setActiveTab('request');
|
||||||
|
|||||||
Reference in new issue
Block a user