Skip to content

Commit d5b0423

Browse files
committed
Remove very expensive & unnecessary mobx computed wrappers
Neither of these is necessary. For starters, both are observable refs, and so will change when updated. For encodedBody, it's actually an observable promise within the ref, so structurally checking it definitely achieves nothing. Downstream usage waits for the returned promise explicitly anyway too. For decodedBody, the struct here was _very_ expensive (10+ seconds of comparison on very large bodies like 25MB+). It's also not necessary because of the explicitly updated observable ref - so all updates are observable. This does mean we may fire extra updates here in the case where Monaco fires a change event but the content hasn't actually changed. That seems very niche, I can't reproduce it, and it's probably much cheaper than this comparison anyway.
1 parent bb71759 commit d5b0423

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/model/http/editable-body.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ export class EditableBody implements BreakpointBody {
7676
return this._encodedBody?.byteLength || 0;
7777
}
7878

79-
@computed.struct
8079
get encoded() {
8180
return this._encodingPromise;
8281
}
8382

84-
@computed.struct
8583
get decoded() {
8684
return this._decodedBody;
8785
}

0 commit comments

Comments
 (0)