Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use page location as indicator for page load #5735

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

benhalpern
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

We check for notifications count in the app shell before the rest of the page loads or is available, so we actually don't know whether document.getElementById('notifications-container') == null is a thing either way.

This code used to be called after the rest of the page loads.

This ensures we don't show the number if anyone lands directly on the notifications page.

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Jan 26, 2020
Copy link
Contributor

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

if (
document.getElementById('notifications-container') == null
window.location.pathname !== '/notifications'
) {
var xmlhttp;
if (window.XMLHttpRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions which could be in another small PR is just some cleanup, e.g. document.getElementById('notifications-number') could be defined once before the if/else and consider moving towards fetch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, definitely

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jan 27, 2020
@benhalpern benhalpern merged commit ac22286 into master Jan 27, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes PR: merged bot applied label for PR's that are merged labels Jan 27, 2020
@maestromac maestromac deleted the ben/fix-notifications-js branch January 27, 2020 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: reviewed-approved bot applied label for PR's where reviewer approves changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants