Repository navigation
Fix console warning when no password set - #3410
Merged
Merged
Conversation
…r not thrown when password is empty Signed-off-by: Adam Warner <me@adamwarner.co.uk>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a console warning by ensuring that the logout button exists before attaching the click event listener.
- Introduces an optional chaining check for logoutButton before adding the event listener
- Prevents potential runtime errors when the password is not set
DL6ER
approved these changes
Apr 23, 2025
DL6ER
left a comment
Member
There was a problem hiding this comment.
The optional chaining (
?.) operator accesses an object's property or calls a function. If the object accessed or function called using this operator is undefined or null, the expression short circuits and evaluates to undefined instead of throwing an error.
100% voodoo
Contributor
|
I'm personally more old-school and prefer explicit returns but this works too of course. As long as it's not overused since optional chaining can have an impact. :) |
Merged
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.
What does this PR aim to accomplish?:
Noticed while starting a container with web password explicitly set to empty.
Ensures that
logoutButtonexists before chaining theaddEventListenermethodhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
By submitting this pull request, I confirm the following:
git rebase)