Improve long-loading logging code from the WebView.#4195
Merged
gnprice merged 3 commits intozulip:masterfrom Jul 22, 2020
Merged
Improve long-loading logging code from the WebView.#4195gnprice merged 3 commits intozulip:masterfrom
gnprice merged 3 commits intozulip:masterfrom
Conversation
ab902d8 to
a7a59d6
Compare
Member
|
Looks good! Two comments:
|
a7a59d6 to
35de7d2
Compare
Contributor
Author
|
Sounds good! I just pushed my latest changes. |
This reverts commit 523b307. In an upcoming commit, we'll replace it with something more organized.
We're about to make another file that will help us get useful logs from inside the WebView to Sentry. This lets us avoid an import cycle; that new file and `js.js` both need to use `sendMessage`.
See 523b307 (reverted in a recent commit) for an earlier attempt at this. It was done quickly to debug a problem with minimal delay; this is the better-organized version of it, informed by Greg's suggestions [1]. [1]: zulip#4180 (comment)
Member
|
Merged -- thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prompted by Greg's suggestions at #4180 (comment).
There are a few differences to call out. If they're problematic, I'll fix them right away, of course!
Since I was making a class anyway, and putting it in its own JS file, I didn't want to entangle that class with the DOM detail of whether the
message-loadingdiv was visible. Instead, I made it so you can call "start" and "stop" methods on the class. I think this will also be useful if we want to log based on other, unrelated states. The code added injs.jsis still much smaller than in the old way.Makes sense. I've pulled out the "scrubbing" logic into its own function, but the difference is: I don't use it in a
map. As soon as the class instance becomes aware of the event, it scrubs it right away, before pushing it to the array.