adambirds/recipe-zulip

Exceptions being thrown in webview.js

timabbott opened this issue · 2 comments

We're seeing this exception on chat.zulip.org:

Message:
Cannot read property 'innerText' of undefined

Stacktrace:
TypeError: Cannot read property 'innerText' of undefined
    at RecipeWebview.getMessages [as loopFunc] (/home/david/.config/Franz/recipes/zulip/webview.js:5:112)

    at EventEmitter.RecipeWebview.ipcRenderer.on (/nix/store/1z6kgd4rswhxch4261frr3i3vpcfpb3s-franz-5.3.1/opt/Franz/resources/app.asar/webview/lib/RecipeWebview.js:18:12)

    at EventEmitter.emit (events.js:182:13)

Basically, the innerText here is failing:
document.querySelectorAll("#global_filters .home-link .count .value")[0].innerText

The issue is that we made some left sidebar HTML/CSS implementation refactors, and .home-link no longer exists. I think you want .top_left_all_messages for newer versions of Zulip.

(Is there a way for the Zulip webapp to provide a function hook for Franz to call for this rather than parsing the DOM so we can expose this as an official API?)

I've been away for a while, but finally back, is this still an issue @timabbott? If so I'm happy to work on it in the next few weeks or so.

Fixed by #6