Open nicknikolov opened 6 years ago
I think uuid collision at https://github.com/choojs/nanotiming/blob/master/browser.js#L18 is another way this error can happen. If the performance mark name is the same, then the mark will be cleared after the first measure is taken and cause this error the second time?
I'm using https://github.com/graforlock/choo-detached to embed multiple choo apps into a single page and I'm seeing this error often for choo.use and choo.emit. I haven't created a simplified test case yet, so I'm not 100% sure on my analysis...
Simple test cases I constructed failed to duplicate the issue I was seeing with multple embedded choo apps. In additon, 'npm update' on one of my embedded apps caused the issue to go away. So I have little confidence in my uuid collision theory. I will report back if I encounter it again and can gather some useful information.
uuid collision theory
yeah, we don't generate UUIDS, but rather nanosecond-precision timestamps. There should be no conflicts here.
This bugs me too. I've created a minimal reproducible test case:
const choo = require('choo');
const html = require('choo/html');
const app = choo();
app.use(() => {});
app.use(() => {}); // <-- this makes it throw in Safari
app.route('/', () => html`<h1>Oh, hi!</h1>`);
document.body.appendChild(app.start());
This happens because choo
calls nanotiming
for each store in a loop. If two or more stores are used, the exception is throw. Apparently perf.now()
always returns the same value in this case.
Here are two solutions that I found to make it work:
(perf.now() * 10000).toFixed()
with (inc++)
where inc
is a module global variable.nanotiming
call for all stores.I can make a PR with either change, or maybe somebody has a better idea.
Uncaught DOMException: Failed to execute 'measure' on 'Performance': The mark 'end-24206000-nanocomponent.render' does not exist.
@yoshuawuyts :