(prevVNode, nextVNode, optimized)
| 4151 | return res; |
| 4152 | }; |
| 4153 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) { |
| 4154 | const { props: prevProps, children: prevChildren, component } = prevVNode; |
| 4155 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; |
| 4156 | const emits = component.emitsOptions; |
| 4157 | if (nextVNode.dirs || nextVNode.transition) { |
| 4158 | return true; |
| 4159 | } |
| 4160 | if (optimized && patchFlag >= 0) { |
| 4161 | if (patchFlag & 1024) { |
| 4162 | return true; |
| 4163 | } |
| 4164 | if (patchFlag & 16) { |
| 4165 | if (!prevProps) { |
| 4166 | return !!nextProps; |
| 4167 | } |
| 4168 | return hasPropsChanged(prevProps, nextProps, emits); |
| 4169 | } else if (patchFlag & 8) { |
| 4170 | const dynamicProps = nextVNode.dynamicProps; |
| 4171 | for (let i = 0; i < dynamicProps.length; i++) { |
| 4172 | const key = dynamicProps[i]; |
| 4173 | if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) { |
| 4174 | return true; |
| 4175 | } |
| 4176 | } |
| 4177 | } |
| 4178 | } else { |
| 4179 | if (prevChildren || nextChildren) { |
| 4180 | if (!nextChildren || !nextChildren.$stable) { |
| 4181 | return true; |
| 4182 | } |
| 4183 | } |
| 4184 | if (prevProps === nextProps) { |
| 4185 | return false; |
| 4186 | } |
| 4187 | if (!prevProps) { |
| 4188 | return !!nextProps; |
| 4189 | } |
| 4190 | if (!nextProps) { |
| 4191 | return true; |
| 4192 | } |
| 4193 | return hasPropsChanged(prevProps, nextProps, emits); |
| 4194 | } |
| 4195 | return false; |
| 4196 | } |
| 4197 | function hasPropsChanged(prevProps, nextProps, emitsOptions) { |
| 4198 | const nextKeys = Object.keys(nextProps); |
| 4199 | if (nextKeys.length !== Object.keys(prevProps).length) { |
no test coverage detected