-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: default image when nft to send has no image #580
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<div class="send-nft-select__wrap"> | ||
<a class="send-nft-select" @click="$emit('toggleSelect', item.id !== '')"> | ||
<div class="send-nft-select__image"> | ||
<img v-if="item.image !== ''" :src="item.image" alt="" /> | ||
<img :src="item.image" alt="" @error="imageLoadError" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent image error handling detected There are two
This inconsistency could lead to different behaviors. Consider applying the same error handling approach to both images. Apply this diff to make the handling consistent: <img :src="item.image" alt="" @error="imageLoadError" />
...
<img
- v-if="item.image !== ''"
class="send-nft-select__view"
:src="item.image"
alt=""
+ @error="imageLoadError"
/> Also applies to: 31-35 |
||
</div> | ||
<div class="send-nft-select__info"> | ||
<h5> | ||
|
@@ -43,6 +43,7 @@ | |
import { PropType } from 'vue'; | ||
import SwitchArrow from '@action/icons/header/switch_arrow.vue'; | ||
import { NFTItemWithCollectionName } from '@/types/nft'; | ||
import { imageLoadError } from '@/ui/action/utils/misc'; | ||
|
||
defineEmits<{ | ||
(e: 'toggleSelect', val: boolean): void; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
🛠️ Refactor suggestion
Prop validation can be improved but type definition is correct
Based on the codebase analysis, the
NFTItemWithCollectionName
interface extendsNFTItem
which has the requiredimage
property as a string. The type definition is correct and ensures type safety. However, the default empty object prop could be improved.The
imageLoadError
utility is correctly imported and used with the properly typed NFT interface.🔗 Analysis chain
Verify NFT type definition and add prop validation
The default empty object for the item prop could lead to undefined behavior. Let's verify the type definition and add validation.
Consider adding required validation:
Also applies to: 33-39
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 86
Script:
Length of output: 30415