airbnb / goji-js

React ❤️ Mini Program
https://goji.js.org
MIT License
224 stars 27 forks source link

Value changes to`undefined` doesn't work on Baidu template #179

Closed malash closed 2 years ago

malash commented 2 years ago

Description

For data in template <template is="temp" data="{{{ ...obj }}}" />, when value in obj changes from non-undefined to undefined, it doesn't work unless you specify its field like <template is="temp" data="{{{ ...obj, value: obj.value }}}" />.

Reproduct link

swanide://fragment/c44d02fd72c5c1f011dccf3f91ef089e1669272840476

Reproduct steps

Open the link on Baidu dev tool, and click the button on page to see UI changes.

Impact

Some fields may fails to update during page rerendering.

https://user-images.githubusercontent.com/1812118/203714962-d8eb1ffe-c7e7-4efc-8308-26e8d302694c.mp4

Temporary solution

We have to specify the field manually.

https://github.com/airbnb/goji-js/blob/8542d995892c30f02fe56967581942dd7f3d79fe/packages/webpack-plugin/src/templates/components/item.wxml.ts#L13-L15

Platforms

malash commented 2 years ago

https://github.com/airbnb/goji-js/pull/180 Introduced a new variable meta to store all data that an elment needed, and this issue was passed by.