无法读取空的属性(正在读取 'length')
作者: sergey-shpak创建于 2023年3月5日更新于 2023年3月7日
标签bug
嘿, 通过调用 null 停止应用程序时, 会抛出以下错误: "无法读取 null 的属性 (读取 'length')"。 看起来问题是由以下代码引起的:```js if ((state = newState) == null) dispatch = subscriptions = render = id if (subscriptions) subs = patchSubs(subs, subscriptions(state), dispatch) 当调用 null 时, subscriptions 变量变成了 (a) => a 的引用。 因此, 当使用 patchSubs(subs, subscriptions(state), dispatch) 调用时, 它返回 null (导致了问题), 而不是数组。
内容来源: hyperapp/hyperapp