Skip to content

Commit

Permalink
fix(minor): useHook and loop improvements suggested by [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
gmsgowtham committed Oct 19, 2023
1 parent ffce3dd commit d460cf1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"devDependencies": {
"@babel/core": "7.23.2",
"@babel/preset-env": "7.23.2",
"@biomejs/biome": "1.2.2",
"@biomejs/biome": "1.3.0",
"@commitlint/config-conventional": "17.8.0",
"@evilmartians/lefthook": "1.5.2",
"@release-it/conventional-changelog": "7.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/components/MDSvg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const MDSvg: FunctionComponent<MDSvgProps> = ({ uri, alt = "image" }) => {
};

fetchSvg();
}, []);
}, [uri]);

const onLayout = (event: LayoutChangeEvent) => {
if (!isFirstLoad.current) {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useMarkdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const useMarkdown = (
tokenizer: options?.tokenizer as Tokenizer<never>,
});
return parser.parse(tokens);
}, [value, parser]);
}, [value, parser, options?.tokenizer]);

return elements;
};
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Parser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class Parser {
): ReactNode[] {
let tokenRenderQueue: Token[] = [];
const siblingNodes: ReactNode[] = [];
tokens.forEach((t) => {
for (const t of tokens) {
/**
* To avoid inlining images
* Currently supports images, link images
Expand Down Expand Up @@ -285,10 +285,10 @@ class Parser {
}

tokenRenderQueue = [];
return;
continue;
}
tokenRenderQueue = [...tokenRenderQueue, t];
});
}

/* Remaining temp tokens if any */
if (tokenRenderQueue.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/__tests__/Renderer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const userStyles: MarkedStyles = {

describe("Renderer", () => {
const themes: ColorSchemeName[] = ["light", "dark"];
themes.forEach((theme) => {
for (const theme of themes) {
const styles = getStyles(userStyles, theme);
describe(`${theme} theme`, () => {
describe("Text Nodes", () => {
Expand Down Expand Up @@ -239,5 +239,5 @@ describe("Renderer", () => {
});
});
});
});
}
});
70 changes: 35 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2312,47 +2312,47 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@biomejs/biome@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.2.2.tgz#cfcceae7f4e55ef057a9b9576ef89563ca0c6d07"
integrity sha512-fXwXi56ZdaKO/N3rTmhWw41UxstoviODk+wia4WWNSlm23r8xJ/NxjaZ88scV2IsmsFHqc8rmwb2dkrStAdIEw==
"@biomejs/biome@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.3.0.tgz#fe679cba35920a09a6efa6ca7d6b2253c654d5c5"
integrity sha512-IKe8eGhiW5PfD4B3GMerS9YucvL1cqEqocVdeBi/Q8o63znqy7aLU2Xc4DAw1qg9OurWxemAp2RQorSqYHwMow==
optionalDependencies:
"@biomejs/cli-darwin-arm64" "1.2.2"
"@biomejs/cli-darwin-x64" "1.2.2"
"@biomejs/cli-linux-arm64" "1.2.2"
"@biomejs/cli-linux-x64" "1.2.2"
"@biomejs/cli-win32-arm64" "1.2.2"
"@biomejs/cli-win32-x64" "1.2.2"

"@biomejs/cli-darwin-arm64@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.2.2.tgz#459a337f574d1a78d9d6a443fc00724d82804ffe"
integrity sha512-Fx1IURKhoqH6wPawtKLT6wcfMSjRRcNK8+VWau0iDOjXvNtjJpSmICbU89B7Vt/gZRwPqkfDMBkFwm6V5vFTSQ==
"@biomejs/cli-darwin-arm64" "1.3.0"
"@biomejs/cli-darwin-x64" "1.3.0"
"@biomejs/cli-linux-arm64" "1.3.0"
"@biomejs/cli-linux-x64" "1.3.0"
"@biomejs/cli-win32-arm64" "1.3.0"
"@biomejs/cli-win32-x64" "1.3.0"

"@biomejs/cli-darwin-arm64@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.3.0.tgz#d63c34f7f62b8cf26739bce8c22412bb5ce7be49"
integrity sha512-O2NhR3ZXw1QknvoKAxwn76U9q/RYvLsZwbYl6+iY79gnL2SL1bljuFMUzRS5R1nNs3H/LOrHUq/JpleKjOwGUw==

"@biomejs/cli-darwin-x64@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.2.2.tgz#892ea688b5d5ddbca9d0bc33c24aa2840a62b284"
integrity sha512-JNaAFOI/ZisnmzvcFNd73geJxaFaN2L4YsWM6cgBeKyLY/ycl9C/PBTFfEmeB1c7f5XIIal8P2cj47kLJpN5Ig==
"@biomejs/cli-darwin-x64@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.3.0.tgz#c2d73ff1310b90542ec25e8931dd93c7c2ca3236"
integrity sha512-8rljS+4nLVuSPuPmuFp64bMZqwmGv9O/6wKoVk0kzeaVD1elSzMz+ZoTrRodbI1Hl8kItDdGf431L7S1EqRokQ==

"@biomejs/cli-linux-arm64@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.2.2.tgz#b7a00f9d9e999daa36ee4581a37a0b13326ec899"
integrity sha512-JHXRnfhOLx8UO/Fcyn2c5pFRri0XKqRZm2wf5oH5GSfLVpckDw2X15dYGbu3nmfM/3pcAaTV46pUpjrCnaAieg==
"@biomejs/cli-linux-arm64@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.3.0.tgz#3c8fa54245146dcec8145495a8ee1b5e0a6e8c9c"
integrity sha512-vQIEaXQf1pPJPetcd4jfM3118sG4AfZvbDuLnU/4lCUIs0XuwPYMcx2KzwXu2m0tn6J4xQsZHvNQyHpiBbp9vA==

"@biomejs/cli-linux-x64@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.2.2.tgz#4c55181f8231e7aa05b2841944a48dd81af443b8"
integrity sha512-5Zr+iM7lUKsw81p9PkXRESuH2/AhRZ6RCWkgE+FSLcxMhXy/4RDR+o2YQDsJM6cWKIzOJM05vDHTGrDq7vXE4A==
"@biomejs/cli-linux-x64@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.0.tgz#edbe082b79d86180127d2f57bc274fe3c7a1dcfd"
integrity sha512-ZH+PvgAZ3nr69O8Tb+MO+08k+0PhG0paWhkIaUW1AUlD7ruIpk+dlHp3DjHauSPFDZkNIxj6utwI1c5lP8hF9w==

"@biomejs/cli-win32-arm64@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.2.2.tgz#6fa05d52903c3fff55bd693c5b1ca778504cd4cc"
integrity sha512-HvUcG2p++RvYP0zfOqh+DgiUUH+JI/uETr0kzWlOJ9F3lsG525pkywg4RSd4OvJd7Wpd3wt3UpN/A4IEJaVmbA==
"@biomejs/cli-win32-arm64@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.3.0.tgz#18682fc22bf6d4b2a410b07b442e7c1c6f331295"
integrity sha512-Mfo1oWXnuOL4zWidx0A7jQSs6+uZZYZB4wuD9lBCbuoQoRNFobGEs11z/iy8XW5mucx+MW4ylTAcDAS+5/2kEw==

"@biomejs/cli-win32-x64@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.2.tgz#583e50d8a1a1cc81381200d3cb2f34669c6afd35"
integrity sha512-bfaFJwqJ9ApFga2o88OaROSd3pasYRzRGXHJWAE9VUUKdSNSTYxHOqVrNvV54yYPtL6Kt9xkuZa4HNu9it3TaA==
"@biomejs/cli-win32-x64@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.0.tgz#c43ee063c6c25cdada09e6da2cf154af0da21747"
integrity sha512-t2EPg+zeMzimBoURfj9CKeNObCZ/MbFxdQj0+K5Q+LR41fUaevG/wOrM+Swh5emRXdSBUm0qsTq3xiyv77C3Ww==

"@callstack/[email protected]":
version "0.10.0"
Expand Down

0 comments on commit d460cf1

Please sign in to comment.