issue #729 Achievement notifications are broken #737
Merged
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.
title: Issue #729 Achievement notifications are broken
Discord Username: @smit309
What type of PR is this? (select all that apply)
Description
Original:
return {snippet.name ?? "-"}
Modified:
return {snippet?.name ?? "-"};
Description: Introduced optional chaining (?.) to ensure that the name property is accessed only if snippet is defined.
Original:
const language = snippetLanguages.find((language) => {
if (language.value === snippet.language) {
return language.label;
}
});
return language?.label;
Modified:
const language = snippet?.language
? snippetLanguages.find((lang) => lang.value === snippet.language)?.label
: null;
return {language ?? "-"};
Description: Refactored the language lookup to use optional chaining and nullish coalescing, ensuring safe access to snippet and snippet.language.
Related Tickets & Documents
Devices:
Chrome Version 120.0.6099.200 (Official Build) (64-bit)
QA Instructions, Screenshots, Recordings
[optional] Are there any post deployment tasks we need to perform?
NO
[optional] What gif best describes this PR or how it makes you feel?
Well, This is my first PR in this website so I understood code very well and i'll do my best to make this website perfect. Thank you. If there is mistake or making this Pr description let me know.