-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v-memo on child of v-for does not render or updates properly #4262
Comments
This is not correct usage:
It's great you're playing around with the API and trying to report back bugs but as said in the PR, if you think memo could be used in other scenarios, described those scenarios first instead of showing abstract cases that are not realistic and are not what memo is trying to solve either |
in the example the forcing the reevaluation of the memo to check if the value changes since last render
also a minimal reproduction of a problem should not reflect a business problem or a use case, it sufficient to show that there is a problem in the most simplistic way for developers to find or identify the bug. there are 2 v-for list that seemingly should have behaved the same and they are not, this is indicative of a bug. |
Thanks for the repro. I actually misread this issue, the different behavior is indeed a bug.
There are: non-reactive variable changes don't trigger template updates in general. In this case, it makes no difference because other variables are triggering a template update but if there are none, you won't see any updates (click 5 times to see no changes) |
(
+ because we disable tracking the block tree here.
_openBlock(true),
_createElementBlock(_Fragment, null, _renderList(_unref(items), (id, index, ___, _cached) => {
const _memo = ([ _unref(flip) ])
+ here currentBlock is null, As a result, the block tree is not tracked correncly in isMemoSame.
if (_cached && _cached.key === id && _isMemoSame(_cached, _memo)) return _cached
const _item = (_openBlock(), _createBlock(Item, {
count: count.value,
index: index,
key: id
}, null, 8 /* PROPS */, ["count", "index"]))
_item.memo = _memo
return _item
}, _cache, 1), 128 /* KEYED_FRAGMENT */)) |
Ok, this is not a bug, but this is currently by design: |
From the user's point, maybe add this into syntax/context checker of Vue compiler? As mentioned above, for current state, Update: |
Version
3.2.0-beta.7
Reproduction link
sfc playground repro
Steps to reproduce
open the Reproduction link
click on inc button, every 5 clicks the memo should trigger an update
there are 2 lists.
v-memo
is on the child elementv-memo
is on the element with thev-for
.in the second list all items will update when the memo dependency changes.
in the first list, there are 2 problems.
What is expected?
2nd list should probably render the same as 1st list
What is actually happening?
inconsistent render with missing values of props
The text was updated successfully, but these errors were encountered: