Skip to content
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

Allow pasting into fields in test UI #189

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

mcintyre94
Copy link
Contributor

@mcintyre94 mcintyre94 commented Jan 25, 2024

I'm not 100% about this fix, I might be missing some nuance about how search bar items work

But the reason pasting was not working is because item.value ||= clipboardText was never updating, because item.value was truthy:
Screenshot 2024-01-25 at 10 13 24

This PR changes it to always replace item.value with the pasted text

An alternative fix would be to remove the {current: true} from the Custom item, so that item.value is just whatever that field contains, but I'm not sure what that represents/would do.
Actually I guess that wouldn't work because then you couldn't paste unless the field was empty. I'm not sure if there are circumstances where we shouldn't change item.value on paste though.

Fixes #188

@mcintyre94 mcintyre94 changed the title Allow pasting into pubkey field in test UI Allow pasting into fields in test UI Jan 25, 2024
Copy link
Member

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20a935c would override any existing text in the input. I think the problem is caused by the last commit that fixed the issue #187.

Specifically the line

We're setting the value to props.value which is an older value, in this case resets the input. I've changed it to use inputRef.current?.value ?? props.value. Let me know if this fixes it.

@acheroncrypto acheroncrypto merged commit d3c19d5 into solana-playground:master Jan 26, 2024
6 checks passed
@mcintyre94
Copy link
Contributor Author

Gotcha thanks, fix looks good! :)

@mcintyre94 mcintyre94 deleted the paste-pubkey branch January 26, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to paste into public key field in test UI
2 participants