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

Use a ref for TargetName input instead of direct dom lookup #4399

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

toddburnside
Copy link
Contributor

While working on an intractable story, I saw this comment and thought "hey, here's something I can atually fix!"

@mergify mergify bot added the explore label Dec 18, 2024
(_, inputRef) =>
inputRef.get
.flatMap(
_.foldMap(i => Callback(timers.setTimeout(50)(i.select())))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With a timeout of zero, this solution had about the same reliability as the previous one. That is to say, the input always got selected but sometimes the cursor was at the end of the field rather than selecting all of the text. With the 50ms delay it has worked every time I tried it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be done as Callback.delayMs(50)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. delayMs returns an AsyncCallback which seemed harder to deal with. I'd have to turn it back into a Callback.

Copy link

bundlemon bot commented Dec 18, 2024

BundleMon

Files updated (1)
Status Path Size Limits
index-(hash).js
1.71MB (+1.38KB +0.08%) -
Unchanged files (7)
Status Path Size Limits
exploreworkers-(hash).js
594.66KB -
index-(hash).css
65.97KB -
workbox-window.prod.es5-(hash).js
2.07KB -
catalogworker-(hash).js
90B -
agsworker-(hash).js
84B -
itcworker-(hash).js
83B -
plotworker-(hash).js
79B -

Total files change +1.38KB +0.06%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link
Contributor

@cquiroz cquiroz left a comment

Choose a reason for hiding this comment

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

LGTM

@toddburnside toddburnside merged commit 817122b into master Dec 19, 2024
14 checks passed
@toddburnside toddburnside deleted the targetname-ref branch December 19, 2024 21:22
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.

2 participants