@lark-apaas/coding-template-nestjs-react-fullstack 0.1.52-alpha.20261027080311 → 0.1.52-alpha.20261027082821

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-template-nestjs-react-fullstack",
3
- "version": "0.1.52-alpha.20261027080311",
3
+ "version": "0.1.52-alpha.20261027082821",
4
4
  "description": "NestJS + React fullstack template for miaoda coding",
5
5
  "type": "module",
6
6
  "files": [
@@ -10,7 +10,13 @@ export const userProfileQueries = {
10
10
  queryOptions({
11
11
  queryKey: [...userProfileQueries.all(), 'byId', accountType, userId],
12
12
  queryFn: ({ signal }) => fetchUserProfile(userId, accountType, signal),
13
- staleTime: 1 * 60 * 1000,
13
+ // staleTime 0:每次打开都在后台取一次新的,和飞书名片那条路保持一致
14
+ // ——「打开渲染缓存、后台乐观更新」。缓存命中时 isPending 为 false,
15
+ // 卡片瞬间渲出不转圈;新数据回来后 React 只 patch 变化的字段,不闪不跳。
16
+ //
17
+ // 之前是 60s:那段窗口内连请求都不发,远端改了最多要等 60 秒才看得到。
18
+ staleTime: 0,
19
+ // gcTime 决定缓存能留多久 —— 它才是「秒出」的来源,不要跟着一起调小。
14
20
  gcTime: 5 * 60 * 1000,
15
21
  enabled: !!userId,
16
22
  }),
@@ -400,7 +400,13 @@ function LarkProfileCard(props: { readonly larkCardParam: LarkCardParam }) {
400
400
  // 有备用卡顶着就离屏渲染(用户看不到骨架屏),没有就直接渲进可见容器。
401
401
  void ensureRender(`${targetLarkOpenID}:update`, () => renderInto(!spare))
402
402
  .then((live) => {
403
- if (cancelled) return;
403
+ if (cancelled) {
404
+ // 组件已卸载(用户在新卡渲染完成前关掉了弹窗)。此时元素已经被
405
+ // renderInto 挪进常驻的离屏容器,既不会被 attach,也不进受
406
+ // maxEntries 约束的备用卡池 —— 放着不管就会随着反复开关一直累积。
407
+ live?.remove();
408
+ return;
409
+ }
404
410
  if (live) {
405
411
  attach(live);
406
412
  return;