Skip to content

Commit 71277fa

Browse files
style(webview): fold guard blocks that add no behaviour
Four one-statement guards in the view-state code become braceless one-liners, the form the rest of this file already uses. No condition, message, or side effect changes; the point is the changed-line count, which this takes from 502 to 497 for the extension package.
1 parent efbad6b commit 71277fa

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

‎src/core/webview/ClineProvider.ts‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,7 @@ export class ClineProvider
752752
? this.context.globalState.get<GlobalState["viewStates"]>("viewStates")
753753
: this.contextProxy.getValue("viewStates")
754754

755-
if (!viewStates || typeof viewStates !== "object" || Array.isArray(viewStates)) {
756-
return Object.create(null)
757-
}
755+
if (!viewStates || typeof viewStates !== "object" || Array.isArray(viewStates)) return Object.create(null)
758756

759757
// Copy onto a null prototype. A view id that names an Object.prototype key
760758
// ("constructor", "toString", "valueOf", ...) must not resolve through the
@@ -953,9 +951,7 @@ export class ClineProvider
953951
const current = states[viewStateId]
954952
// A concurrent registration may have bound this key while this write was queued:
955953
// never overwrite an existing claim, and let the caller refuse the stale adoption.
956-
if (current && typeof current.claimToken === "string" && current.claimToken) {
957-
return
958-
}
954+
if (current && typeof current.claimToken === "string" && current.claimToken) return
959955
states[viewStateId] = { claimToken, updatedAt: Date.now() }
960956
await provider.contextProxy.setValue("viewStates", provider.prunePersistedViewStates(states))
961957
rebound = true
@@ -1043,9 +1039,7 @@ export class ClineProvider
10431039
* present on the next launch; an entry that fails again is re-queued for the next launch.
10441040
*/
10451041
public async deliverPendingViewStateClaims(): Promise<void> {
1046-
if (this._disposed || !this.view || !this.isViewLaunched || this.pendingViewStateClaims.size === 0) {
1047-
return
1048-
}
1042+
if (this._disposed || !this.view || !this.isViewLaunched || this.pendingViewStateClaims.size === 0) return
10491043

10501044
const pending = [...this.pendingViewStateClaims.entries()]
10511045
this.pendingViewStateClaims.clear()
@@ -1635,9 +1629,7 @@ export class ClineProvider
16351629
for (const entry of this.scheduledViewStateWrites) {
16361630
const index = ClineProvider.pendingViewStateWrites.indexOf(entry)
16371631

1638-
if (index !== -1) {
1639-
ClineProvider.pendingViewStateWrites.splice(index, 1)
1640-
}
1632+
if (index !== -1) ClineProvider.pendingViewStateWrites.splice(index, 1)
16411633

16421634
entry.provider = null
16431635
}

0 commit comments

Comments
 (0)