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

Changing the Zarr URL is annoying #46

Closed
aganders3 opened this issue Mar 7, 2024 · 1 comment · Fixed by #50
Closed

Changing the Zarr URL is annoying #46

aganders3 opened this issue Mar 7, 2024 · 1 comment · Fixed by #50
Assignees
Labels
bug Something isn't working

Comments

@aganders3
Copy link
Collaborator

For some reason I can't select all and delete or start typing a new URL. I think this is because it's trying to update on every change. It may be a better experience if the user has to hit enter/return to fetch a new Zarr.

@andy-sweet
Copy link
Collaborator

andy-sweet commented Mar 8, 2024

One option I thought about is to use onBlur instead of onChange, which represents a lose-focus event: https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event

But that doesn't let you change the text because we're setting the value from the dataUrl React state, which doesn't get updated until that lose-focus event! There must be some sane workaround for this...

@andy-sweet andy-sweet self-assigned this Mar 11, 2024
@aganders3 aganders3 added the bug Something isn't working label Mar 12, 2024
andy-sweet added a commit that referenced this issue Mar 13, 2024
This uses `defaultValue` instead of `value` in the JSX component definition, to allow more flexible editing on the Zarr URL. This also changes the `dataUrl` state from a `URL` to a `string` to simplify passing it around and validating it.

Closes #46 

---------

Co-authored-by: Ashley Anderson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants