#1111·hyperapp

Cannot read properties of null (reading 'length')

Author: sergey-shpakCreated Mar 5, 2023Updated Mar 7, 2023
Labelsbug

Hey, when stopping the app by dispatching null, the following error is thrown: "Cannot read properties of null (reading 'length')".

It looks like the issue is caused by the following code:

javascript
if ((state = newState) == null) dispatch = subscriptions = render = id
if (subscriptions) subs = patchSubs(subs, subscriptions(state), dispatch)

When null is dispatched, the subscriptions variable becomes a reference to (a) => a. As a result, it returns null when called with patchSubs(subs, subscriptions(state), dispatch) instead of an array (which is causing the issue)