Skip to content

Commit

Permalink
fix: avoid crash when changing tab in send asset popup (#7453)
Browse files Browse the repository at this point in the history
* fix: avoid crash when changing tab in send asset popup

* feat: always remain the value of the input when changing tabs

* chore: improve naming

---------

Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
  • Loading branch information
VmMad and begonaalvarezd authored Oct 17, 2023
1 parent 50df02e commit b372880
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions packages/shared/components/inputs/NftInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
export let nftId: string = ''
export let error: string = ''
export let readonly: boolean = null
export let readonly: boolean | null = null
let inputElement: HTMLInputElement = undefined
let inputElement: HTMLInputElement | undefined = undefined
let modal: Modal = undefined
let selected: IOption = nftId
? { key: getNftByIdFromAllAccountNfts($selectedAccountIndex, nftId).name, value: nftId }
: {}
const selectedNft = getNftByIdFromAllAccountNfts($selectedAccountIndex, nftId)
let selected: IOption | undefined = selectedNft
? { key: selectedNft.name, value: selectedNft.id }
: { value: nftId }
const nftOptions: IOption[] = $ownedNfts
.filter((nft) => nft.isSpendable && (!nft.timelockTime || nft.timelockTime < $time.getTime()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { allAccountNfts } from '../stores'
import { INft } from '../interfaces'
import { get } from 'svelte/store'

export function getNftByIdFromAllAccountNfts(accountIndex: number, nftId: string): INft {
export function getNftByIdFromAllAccountNfts(accountIndex: number, nftId: string): INft | undefined {
return get(allAccountNfts)[accountIndex]?.find((_nft) => _nft.id === nftId)
}

0 comments on commit b372880

Please sign in to comment.