diff --git a/packages/notebook-extension/src/trusted.tsx b/packages/notebook-extension/src/trusted.tsx index 61a1a16d12..87b3e6a771 100644 --- a/packages/notebook-extension/src/trusted.tsx +++ b/packages/notebook-extension/src/trusted.tsx @@ -17,16 +17,19 @@ const isTrusted = (notebook: Notebook): boolean => { return false; } const cells = Array.from(model.cells); - - const trusted = cells.reduce((accum, current) => { - if (current.trusted) { - return accum + 1; - } else { - return accum; + let total = 0; + let trusted = 0; + + for (const current_cell of cells) { + if (current_cell.type !== 'code') { + continue; + } + total++; + if (current_cell.trusted) { + trusted++; } - }, 0); + }; - const total = cells.length; return trusted === total; };