question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onInput performance ( even crash browser )

See original GitHub issue

Hi, I am using onInput for my input field. here’s the emitter:

emitter.on('inputUsername', (e) => {
		let input = e.target.value
		if(input.length < 9){
			if(input === '' || input.match(/^[a-z0-9]+$/i)){
				state.input.username = input.toLowerCase()
				emitter.emit('render')
			}
			else{
				state.input.username = input.slice(0, input.length - 1)
				emitter.emit('render')
			}
		}
		else{
			emitter.emit('render')
		}
	})

While typing a lot of characters, for example a,b,c,backspace,backspace,d,e, etc will crash the browser ( google chrome in my case ). After a bit of research, the google chrome dump is telling me that the browser ran out of memory.

Also, while testing on my mobile devices the browser doesnt crash but the performance is so bad. After I press a character in the keyboard, the dom need about .3s - .5s to rerender it.

Is there any solution? I need to make sure the username field less than 9 chars and alphanumeric only.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
yoshuawuytscommented, Oct 11, 2017

Oh; glad to hear it’s not us! — if you ever run into more slowdowns (especially with long lists), we now have an issue to handle that! https://github.com/choojs/nanomorph/issues/85

On Wed, Oct 11, 2017 at 8:24 AM Rahmat Albariqi notifications@github.com wrote:

@yoshuawuyts https://github.com/yoshuawuyts just start a new project and using choo. This time oninput does not crash and run smoothly. My previous project that had oninput crash is using JSS ( https://github.com/cssinjs/jss) which uses a lot of variables as classname. I think JSS is causing the slow down, even crash.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/choojs/choo/issues/564#issuecomment-335792272, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWleovTLhMsEgQoz8vADxC4RtVp6i8vks5srLOHgaJpZM4PZTwm .

0reactions
bcomnescommented, Oct 11, 2017

Perhaps we could figure out if there is something going on between choo and jss.

Read more comments on GitHub >

github_iconTop Results From Across the Web

240757 - Setting CSS style on INPUT elements causes crash when ...
If the textbox already has text in it (value="a"), all the user has to do is click in the field to cause the...
Read more >
353691 - oninput doesn't fire when field is changed by autofill
Issue 353691: oninput doesn't fire when field is changed by autofill. This issue has been migrated to Launch, see link in final comment...
Read more >
[#ZBX-21949] List with too many macros affecting browser ...
List with too many macros affecting browser performance ... and host macros" button (higher values even crash the page just by clicking on...
Read more >
Lots of crash fixes – Vivaldi Browser snapshot 2643.3
Today's snapshot includes a bunch of fixes for common crashes, a (minor) Chromium and lots of other small improvements.
Read more >
Dying, fast and slow: out-of-memory crashes in Python
Sometimes if you're lucky you might even get a nice traceback, ... lot of memory: a browser, an IDE, the program you're testing,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found