diff --git a/CHANGELOG.md b/CHANGELOG.md index fc7c76391f..a483b540ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ Changelog _Note: Gaps between patch versions are faulty, broken or test releases._ +## v4.0.0-beta.172 (2024-12-25) + +#### :boom: Breaking Change + +* Updated `@v4fire/core` to version `4.0.0-alpha.54` with renaming `Function.prototype.once` to `memoize` + ## v4.0.0-beta.171 (2024-12-23) #### :house: Internal diff --git a/src/components/directives/bind-with/interface.ts b/src/components/directives/bind-with/interface.ts index 6763e92892..57a5b27027 100644 --- a/src/components/directives/bind-with/interface.ts +++ b/src/components/directives/bind-with/interface.ts @@ -6,7 +6,7 @@ * https://github.com/V4Fire/Client/blob/master/LICENSE */ -import type { EventEmitterLike, PromiseLikeP } from 'core/async'; +import type { EventEmitterLikeP, PromiseLikeP } from 'core/async'; import type { DirectiveBinding } from 'core/component/engines'; import type { WatchOptions } from 'core/component/interface'; @@ -62,7 +62,7 @@ export interface EventListener extends Handle { /** * An event emitter to listen */ - emitter?: EventEmitterLike | EventEmitterLike['on']; + emitter?: EventEmitterLikeP; /** * The event name to listen for, or a list of such events diff --git a/src/components/directives/bind-with/test/unit/main.ts b/src/components/directives/bind-with/test/unit/main.ts index 93e28c2d80..f31b18b5ac 100644 --- a/src/components/directives/bind-with/test/unit/main.ts +++ b/src/components/directives/bind-with/test/unit/main.ts @@ -47,6 +47,7 @@ test.describe('components/directives/bind-with', () => { const el = await renderDirective(page, { emitter: (event: string, listener: AnyFunction) => { document.body.addEventListener(event, listener); + return undefined; }, on: 'testEvent' diff --git a/src/components/super/i-block/base/index.ts b/src/components/super/i-block/base/index.ts index 2803c538a7..8e85152039 100644 --- a/src/components/super/i-block/base/index.ts +++ b/src/components/super/i-block/base/index.ts @@ -519,7 +519,7 @@ export default abstract class iBlockBase extends iBlockFriends { // eslint-disable-next-line prefer-const unwatch: Nullable; - const emitter: Function = (_: any, wrappedHandler: RawWatchHandler) => { + const emitter = (_: any, wrappedHandler: RawWatchHandler) => { wrappedHandler['originalLength'] = handler['originalLength'] ?? handler.length; handler = wrappedHandler; diff --git a/src/core/component/engines/vue3/component.ts b/src/core/component/engines/vue3/component.ts index 91bc957610..84d445ca3a 100644 --- a/src/core/component/engines/vue3/component.ts +++ b/src/core/component/engines/vue3/component.ts @@ -67,7 +67,7 @@ export function getComponent(meta: ComponentMeta): ComponentOptions { + const emitter = (_: unknown, handler: WatchHandler) => { // eslint-disable-next-line @v4fire/unbound-method const {unwatch} = watch(unsafe.$fields, {deep: true, immediate: true}, handler); return unwatch; diff --git a/src/core/component/init/states/before-create.ts b/src/core/component/init/states/before-create.ts index 80c09af384..4cfc54c0e7 100644 --- a/src/core/component/init/states/before-create.ts +++ b/src/core/component/init/states/before-create.ts @@ -121,7 +121,7 @@ export function beforeCreateState( let fn = () => ('getRoot' in ctx ? ctx.getRoot?.() : null) ?? ctx.$root; - fn = fn.once(); + fn = fn.memoize(); Object.defineProperty(ctx, $getRoot, { configurable: true, @@ -163,7 +163,7 @@ export function beforeCreateState( return targetCtx[$getParent]; } - let fn: CanUndef; + let fn: CanUndef; if (restArgs != null) { // VNODE @@ -179,7 +179,7 @@ export function beforeCreateState( fn = () => ctx; } - fn = fn.once(); + fn = fn.memoize(); Object.defineProperty(targetCtx, $getParent, { configurable: true, diff --git a/src/core/init/dependencies/helpers.ts b/src/core/init/dependencies/helpers.ts index 679fc746ac..9cc5bb46cc 100644 --- a/src/core/init/dependencies/helpers.ts +++ b/src/core/init/dependencies/helpers.ts @@ -137,7 +137,7 @@ export function* createDependencyIterator( wait: expandedWait }; - expandedDependency.fn = expandedDependency.fn.once(); + expandedDependency.fn = expandedDependency.fn.memoize(); expandedDependencies.set(dependency, expandedDependency); return expandedDependency;