byteclubfr / copycast

Live remote copy-pasta explorer for training sessions
39 stars 0 forks source link

Freeze when click on huge file #18

Closed naholyr closed 8 years ago

naholyr commented 8 years ago

I have react.js which is properly ignored (with message "too big"), but when I click on my build.js (browserify + babelify with react) the UI gets frozen. I assume it tries to render the file, ignoring its size.

Delapouite commented 8 years ago

Here are the current heuristics to check if a file is considered too huge to be parsed by highlight.js : https://github.com/byteclubfr/copycast/blob/master/server/watcher.js#L14-L21

files called 'bundle.js' should already be ignored.

naholyr commented 8 years ago

OK, issue is here: https://github.com/byteclubfr/copycast/blob/master/server/watcher.js#L18 Checking if there is more than 2000 lines is not enough, in my case it was one single line of 1.6 megabytes ;) so total size should be checked too.

I'll go for this change to fix the bug, I think almost all our files are around 1 to 5 Kb, we can safely assume any file > 50 Kb can be ignored, so let's go for 200 Kb.