Closed cwastche closed 3 weeks ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
eternum | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 17, 2024 9:35am |
β±οΈ Estimated effort to review [1-5] | 2 |
π§ͺ Relevant tests | No |
π Security concerns | No |
β‘ Key issues to review |
Possible Bug: Ensure that shortString.decodeShortString correctly handles all expected input formats and edge cases, as it replaces hexToAscii(numberToHex(Number(entityName.name))) . This change in decoding logic could potentially introduce bugs if not all scenarios are covered. |
Refactoring Impact: The removal of the non-null assertion in useGuilds.tsx simplifies the code but ensure that userGuildEntityId is always defined where used, or handle potential undefined cases. |
Category | Suggestion | Score |
Enhancement |
Simplify the code by removing redundant BigInt conversion___ **Ensure thatuserGuildEntityId is always treated as a BigInt by removing the unnecessary conditional check, as it is already converted to BigInt in the new code.** [client/src/hooks/helpers/useGuilds.tsx [83]](https://github.com/BibliothecaDAO/eternum/pull/950/files#diff-4a6ae30a3969851b248ce9c56e472b99b3f3ae1a4598fd3610e91aadc0899fa0R83-R83) ```diff -const guildName = userGuildEntityId ? getEntityName(BigInt(userGuildEntityId)) : undefined; +const guildName = userGuildEntityId ? getEntityName(userGuildEntityId) : undefined; ``` Suggestion importance[1-10]: 7Why: The suggestion correctly identifies that the redundant BigInt conversion can be removed, simplifying the code. However, this is a minor enhancement and does not address a major issue. | 7 |
Maintainability |
Remove unnecessary conditional check for better code clarity___ **Remove the unnecessary check forguild_entity_id in the conditional operator since it's already ensured to be non-null by the context.** [client/src/hooks/helpers/useGuilds.tsx [83]](https://github.com/BibliothecaDAO/eternum/pull/950/files#diff-4a6ae30a3969851b248ce9c56e472b99b3f3ae1a4598fd3610e91aadc0899fa0R83-R83) ```diff -const guildName = userGuildEntityId ? getEntityName(BigInt(userGuildEntityId)) : undefined; +const guildName = getEntityName(BigInt(userGuildEntityId)); ``` Suggestion importance[1-10]: 6Why: The suggestion improves code clarity by removing an unnecessary check. However, this is a minor maintainability improvement and does not address a critical issue. | 6 |
Possible issue |
Verify the correctness of the
___
**Consider checking if | 5 |
User description
Closes #947
PR Type
Bug fix, Enhancement
Description
useEntities.tsx
to useshortString.decodeShortString
instead ofhexToAscii
.getEntityName
function call inuseGuilds.tsx
by removing unnecessary non-null assertion.formatGuilds
function inuseGuilds.tsx
.Changes walkthrough π
useEntities.tsx
Update entity name decoding method to use `shortString`.
client/src/hooks/helpers/useEntities.tsx
hexToAscii
import.shortString
import fromstarknet
.hexToAscii
withshortString.decodeShortString
for decodingentity names.
useGuilds.tsx
Simplify guild name retrieval and improve readability.
client/src/hooks/helpers/useGuilds.tsx
getEntityName
function call by removing unnecessarynon-null assertion.
formatGuilds
function.