google / google/site-kit-wp

Console error: Cannot read properties of undefined (reading 'hasClass')

Open
#8,873 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
383
Avg merge
4d 14h
Merged PRs (30d)
77

Description

## Bug Description

On and off, I'll get this error in my console. Not sure if this is something to be fixed:
```
wp-auth-check.min.js?ver=6.5.4:2 Uncaught TypeError: Cannot read properties of undefined (reading 'hasClass')
at HTMLDocument. (wp-auth-check.min.js?ver=6.5.4:2:655)
at HTMLDocument.dispatch (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:40035)
at v.handle (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:38006)
at Object.trigger (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:70124)
at HTMLDocument. (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:70726)
at Function.each (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:3129)
at e..each (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:1594)
at e..trigger (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:70701)
at Object. (heartbeat.min.js?ver=6.5.4:2:2186)
at c (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.4:2:25304)
```

## Steps to reproduce

There is no specific steps that I can provide here as it's just random.

## Screenshots

Screenshot 2024-06-14 at 15 14 57

## Additional Context

- PHP Version: 8.1
- Browser: Chrome
- Plugin Version: 1.129
- Device: Macbook Pro (McOS Sonoma)

---------------

_Do not alter or remove anything below. The following sections will be managed by moderators only._

## Acceptance criteria

*

## Implementation Brief

* [ ]

### Test Coverage

*

## QA Brief

*

## Changelog entry

*

Contributor guide

Open the contributing guide

Research direction

The report identifies wp-auth-check.min.js, heartbeat.min.js, and the jQuery event path in load-scripts.php; start by tracing the document event that reaches hasClass. Reproduce the intermittent console error if possible, then verify that the same flow no longer logs the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wordpress
Domain
authentication, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.