Skip to content

Commit

Permalink
fix(docs): repl infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed Sep 21, 2024
1 parent 6c4c5b9 commit 751eb5c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/docs/src/repl/repl-output-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const deepUpdate = (prev: any, next: any) => {
if (prev[key] && typeof next[key] === 'object' && typeof prev[key] === 'object') {
deepUpdate(prev[key], next[key]);
} else {
prev[key] = next[key];
if (prev[key] !== next[key]) {
prev[key] = next[key];
}
}
}
for (const key in prev) {
Expand All @@ -17,10 +19,12 @@ const deepUpdate = (prev: any, next: any) => {
};

export const updateReplOutput = async (store: ReplStore, result: ReplResult) => {
store.diagnostics = result.diagnostics;
deepUpdate(store.diagnostics, result.diagnostics);

if (store.diagnostics.length === 0) {
store.html = result.html;
if (result.diagnostics.length === 0) {
if (store.html !== result.html) {
store.html = result.html;
}
deepUpdate(store.transformedModules, result.transformedModules);
deepUpdate(store.clientBundles, result.clientBundles);
deepUpdate(store.ssrModules, result.ssrModules);
Expand Down

0 comments on commit 751eb5c

Please sign in to comment.