Skip to content

Commit d54fed2

Browse files
authored
fix(signal-tracker): firefox and chromium loop over different stack traces (@Leonabcd123) (monkeytypegame#7754)
### Description First signal's first frame in `frames` array in https://github.com/monkeytypegame/monkeytype/blob/82bf09564c2fdaaeb8273c638ec1eb7e7e6eb3cb/frontend/src/ts/dev/signal-tracker.ts#L35 Chromium: `at getCallerInfo (http://localhost:3000/ts/dev/signal-tracker.ts?t=1774961577350:5:16)` Firefox: `DEV.hooks.afterRegisterGraph@http://localhost:3000/ts/dev/signal-tracker.ts?t=1774961577350:84:34` They both should be referring to `getCallerInfo`, but only chromium does, because firefox slices off that frame in the code linked above, while chromium slices off the string "Error". Doesn't really matter because the `getCallerInfo` frame will be skipped anyways, but this should still be done to make behavior more consistent across different browsers.
1 parent e8f8bf8 commit d54fed2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

frontend/src/ts/dev/signal-tracker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ type SolidOwner = {
3232
function getCallerInfo(): { isUserCode: boolean; source: string } {
3333
const stack = new Error().stack;
3434
if (stack === undefined) return { isUserCode: false, source: "" };
35-
const frames = stack.split("\n").slice(1);
35+
const frames = stack.split("\n");
3636

3737
if (frames.some((f) => f.includes("useRefWithUtils"))) {
3838
return { isUserCode: false, source: "" };
3939
}
4040

4141
for (const frame of frames.toReversed()) {
42-
if (frame === "") continue;
42+
if (frame === "" || frame === "Error") continue;
4343
if (frame.includes("signal-tracker")) continue;
4444
if (frame.includes("solid-js")) continue;
4545
if (frame.includes("@solid-refresh")) continue;

frontend/src/ts/test/test-ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ async function joinOverlappingHints(
227227
activeWordLetters: ElementsWithUtils,
228228
hintElements: HTMLCollection,
229229
): Promise<void> {
230-
const [isWordRightToLeft, _isFullMatch] = Strings.isWordRightToLeft(
230+
const [isWordRightToLeft] = Strings.isWordRightToLeft(
231231
TestWords.words.getCurrent(),
232232
TestState.isLanguageRightToLeft,
233233
TestState.isDirectionReversed,

0 commit comments

Comments
 (0)