Description: Refactored the language lookup to use optional chaining and nullish coalescing, ensuring safe access to snippet and snippet.language.
Related Tickets & Documents
Related Issue #
Closes #
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.
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.