Skip to content

Commit a09e006

Browse files
committed
chore: update comments
1 parent 599a60c commit a09e006

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/runtime-vapor/src/components/KeepAlive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export const VaporKeepAliveImpl: ObjectVaporComponent = defineVaporComponent({
232232
return children
233233
}
234234

235+
// inject hooks to DynamicFragment to cache components during updates
235236
const injectKeepAliveHooks = (frag: DynamicFragment) => {
236237
;(frag.beforeTeardown || (frag.beforeTeardown = [])).push(
237238
(oldKey, nodes, scope) => {
@@ -284,7 +285,7 @@ const shouldCache = (
284285
: (block as GenericComponentInstance).type
285286
) as GenericComponent & AsyncComponentInternalOptions
286287

287-
// always cache unresolved async components
288+
// return true to ensure hooks are injected into its block (DynamicFragment)
288289
if (isAsync && !type.__asyncResolved) {
289290
return true
290291
}

packages/runtime-vapor/src/fragment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class DynamicFragment extends VaporFragment {
7070
fallback?: BlockFn
7171
anchorLabel?: string
7272

73-
// get the scope for the current key when used in keep-alive
73+
// get the kept-alive scope when used in keep-alive
7474
getScope?: (key: any) => EffectScope | undefined
7575

7676
// hooks

0 commit comments

Comments
 (0)