fix(web): guard undefined hash in commit detail view - #7148
Open
vikash7485 wants to merge 1 commit into
Open
Conversation
vikash7485
requested review from
Warashi,
hongky-1994,
khanhtc1202 and
t-kikuc
August 11, 2026 03:50
When hash is undefined (e.g. from older Piped v0 messages where the field was unpopulated), hash.slice(0, 7) throws: TypeError: Cannot read properties of undefined (reading 'slice') Add null-coalescing fallback to empty string before slicing. Related: pipe-cd#6706 Signed-off-by: vikash7485 <vikkiraj073@gmail.com>
vikash7485
force-pushed
the
fix/guard-undefined-commit-hash
branch
from
August 11, 2026 04:02
9fc67c1 to
818473d
Compare
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 this PR does:
Guard against
undefinedhash in the deployment detail commit section by adding a null-coalescing fallback (?? "") before calling.slice(0, 7).Why we need it:
When
deployment.trigger.commit.hashisundefined(possible from older Piped v0 protobuf messages where the field was unpopulated), the current code calls.slice(0, 7)directly onundefined, causing a runtime crash:The outer guard at L254 (
deployment.trigger?.commit &&) only checks thatcommitexists, not thathashis populated. This fix adds a safe fallback so the link renders with an empty string instead of crashing.Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?:
No. This prevents a crash for an edge case. Users with valid commit hashes see no difference.