DEV: Avoid site-header error when rendering fails (#22993)

When Ember rendering fails for some reason, `this.header` will be undefined. This causes site-header to raise an error, which often gets printed to the console more obviously than the actual root cause.

This commit makes site-header fail more gracefully in this situation, to avoid it being a red-herring during development/debugging.
This commit is contained in:
David Taylor 2023-08-07 17:03:13 +01:00 committed by GitHub
parent c996b7fe4b
commit a38830c009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -486,7 +486,7 @@ export default SiteHeaderComponent.extend({
this._resizeObserver = new ResizeObserver((entries) => {
for (let entry of entries) {
if (entry.contentRect) {
const headerTop = this.header.offsetTop;
const headerTop = this.header?.offsetTop;
document.documentElement.style.setProperty(
"--header-top",
`${headerTop}px`