Endless string of "undefined" prints after original content string
Closed this issue · 8 comments
In a statement on line 26 of src/index.js
, the finished
variable is compared against the value content.length
. If they are equivalent, the intervals are cleared and the scifi
function execution ends.
However, it seems that the finished
variable can occasionally become incremented beyond the value of content.length
before that statement is evaluated. When this happens, the content on the page is repeated appended with "undefined".
@garylocke yes, it should be updated (since it's using the CDN version)
Still an issue. I am noticing that I can only reproduce it by running the demo site in a background tab, which leads me to believe it may have something to do with a race condition between the two intervals, though I'm not certain of that.
Pull request #7 introduces a check on the content character before appending it to the finished string. This should eliminate the possibility of finishedString.length
ever exceeding content.length
, allowing the clearInterval
statements to always execute eventually.
Once the CDN version is updated, we can try again to reproduce this issue.
Yeah updated.
Great. I'm testing this in two tabs, one of which is running in the background.
Over an hour in the background without any issue. I'm comfortable calling this fixed for now if you are.
EDIT: Now running without issue for several hours.
I'm going to close this, since I am no longer able to reproduce the issue.