webdevcody / code-racer

https://code-racer-eight.vercel.app
MIT License
694 stars 514 forks source link

issue #729 Achievement notifications are broken #737

Closed smit309 closed 3 months ago

smit309 commented 9 months ago

title: Issue #729 Achievement notifications are broken

Discord Username: @smit309

What type of PR is this? (select all that apply)

Description

  1. Change in Name Cell Rendering:

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.

  1. Change in Language Cell Rendering:

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

image

[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.