fix(vMemo): prevent unexpected render in v-for + v-memo #14002
ci.yml
on: pull_request
test
/
unit-test
54s
test
/
unit-test-windows
58s
test
/
e2e-test
1m 19s
test
/
lint-and-test-dts
46s
continuous-release
1m 1s
Annotations
4 errors
packages/compiler-core/__tests__/transforms/vMemo.spec.ts > compiler: v-memo transform > element v-for key expression prefixing + v-memo:
packages/compiler-core/__tests__/transforms/vMemo.spec.ts#L62
Error: Snapshot `compiler: v-memo transform > element v-for key expression prefixing + v-memo 1` mismatched
- Expected
+ Received
@@ -1,12 +1,13 @@
"import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, isMemoSame as _isMemoSame, withMemo as _withMemo } from "vue"
export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [
- (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.tableData, (data, __, ___, _cached) => {
+ (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.tableData, (data, __, ___, _cachedListItem, _cachedMap) => {
const _memo = (_ctx.getLetter(data))
- if (_cached && _cached.key === _ctx.getId(data) && _isMemoSame(_cached, _memo)) return _cached
+ const _cached = ((_cachedMap && _cachedMap[_ctx.getId(data)]) || (_cachedListItem && _cachedListItem.key === _ctx.getId(data) && _cachedListItem))
+ if (_cached && _isMemoSame(_cached, _memo)) return _cached
const _item = (_openBlock(), _createElementBlock("span", {
key: _ctx.getId(data)
}))
_item.memo = _memo
return _item
❯ packages/compiler-core/__tests__/transforms/vMemo.spec.ts:62:7
|
test / unit-test
Process completed with exit code 1.
|
packages/compiler-core/__tests__/transforms/vMemo.spec.ts > compiler: v-memo transform > element v-for key expression prefixing + v-memo:
packages/compiler-core/__tests__/transforms/vMemo.spec.ts#L62
Error: Snapshot `compiler: v-memo transform > element v-for key expression prefixing + v-memo 1` mismatched
- Expected
+ Received
@@ -1,12 +1,13 @@
"import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, isMemoSame as _isMemoSame, withMemo as _withMemo } from "vue"
export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [
- (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.tableData, (data, __, ___, _cached) => {
+ (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.tableData, (data, __, ___, _cachedListItem, _cachedMap) => {
const _memo = (_ctx.getLetter(data))
- if (_cached && _cached.key === _ctx.getId(data) && _isMemoSame(_cached, _memo)) return _cached
+ const _cached = ((_cachedMap && _cachedMap[_ctx.getId(data)]) || (_cachedListItem && _cachedListItem.key === _ctx.getId(data) && _cachedListItem))
+ if (_cached && _isMemoSame(_cached, _memo)) return _cached
const _item = (_openBlock(), _createElementBlock("span", {
key: _ctx.getId(data)
}))
_item.memo = _memo
return _item
❯ packages/compiler-core/__tests__/transforms/vMemo.spec.ts:62:7
|
test / unit-test-windows
Process completed with exit code 1.
|