Skip to content

fix(vMemo): prevent unexpected render in v-for + v-memo #14002

fix(vMemo): prevent unexpected render in v-for + v-memo

fix(vMemo): prevent unexpected render in v-for + v-memo #14002

Triggered via pull request November 22, 2024 10:08
Status Failure
Total duration 1m 30s
Artifacts

ci.yml

on: pull_request
Fit to window
Zoom out
Zoom in

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.