Skip to content

Commit 7b329b4

Browse files
adigaboypre-commit-ci[bot]github-actions[bot]jtpio
authored
fix trusted status indication (#7036)
* fix isTrusted with check cell type * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * camelCase and redundant ; * Update Playwright Snapshots * Update Playwright Snapshots --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Tuloup <[email protected]>
1 parent 2a9e903 commit 7b329b4

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/notebook-extension/src/trusted.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ const isTrusted = (notebook: Notebook): boolean => {
1717
return false;
1818
}
1919
const cells = Array.from(model.cells);
20+
let total = 0;
21+
let trusted = 0;
2022

21-
const trusted = cells.reduce((accum, current) => {
22-
if (current.trusted) {
23-
return accum + 1;
24-
} else {
25-
return accum;
23+
for (const currentCell of cells) {
24+
if (currentCell.type !== 'code') {
25+
continue;
2626
}
27-
}, 0);
27+
total++;
28+
if (currentCell.trusted) {
29+
trusted++;
30+
}
31+
}
2832

29-
const total = cells.length;
3033
return trusted === total;
3134
};
3235

Loading
Loading

0 commit comments

Comments
 (0)