Actions between cacheHandlers true and false are different
Version
3.0.11
Reproduction link
Steps to reproduce
<div @click.self="fn" />
What is expected?
make them same
What is actually happening?
export function render(_ctx, _cache) {
return (_openBlock(), _createBlock("div", {
onClick: _cache[1] || (_cache[1] = _withModifiers((...args) => (_ctx.fn && _ctx.fn(...args)), ["self"]))
}))
}
export function render(_ctx, _cache) {
return (_openBlock(), _createBlock("div", {
onClick: _withModifiers(_ctx.fn, ["self"])
}, null, 8 /* PROPS */, ["onClick"]))
}
- change
(_ctx.fn && _ctx.fn(...args))
to_ctx.fn(...args)
, disallow_ctx.fn
being falsy - or,
- change
return fn(event, ...args);
(inwithModifiers
) toreturn fn ? fn(event, ...args) : void 0;
- and,
- change
(_ctx.fn && _ctx.fn(...args))
to_ctx.fn?.(...args)
, disallow_ctx.fn
beingfalse
, - or change
(_ctx.fn && _ctx.fn(...args))
to_ctx.fn ? _ctx.fn(...args) : void 0
, avoid when_ctx.fn
isfalse
, the dom event handler returnfalse
which will make side effects.
- change
- change