Skip to content

Commit

Permalink
[Update] Improve logical details
Browse files Browse the repository at this point in the history
  • Loading branch information
rakuyoMo committed Jan 9, 2024
1 parent 487042f commit 656b3c9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/View/JSONPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,17 @@ extension JSONPreview: JSONTextViewDelegate {
// 3. Get the clicked slice
let clickSlice = slices[realRow]

defer {
delegate?.jsonPreview(self, didChangeSliceState: slices[realRow], decorator: decorator)
}

// 4. Perform different operations based on slice status
switch clickSlice.state {

// 4.1. Expanded state: perform folded operation
case .expand:
guard let folded = clickSlice.folded else { return }

defer {
delegate?.jsonPreview(self, didChangeSliceState: slices[realRow], decorator: decorator)
}

decorator.slices[realRow].state = .folded

var isExecution = true
Expand Down Expand Up @@ -508,6 +508,10 @@ extension JSONPreview: JSONTextViewDelegate {
case .folded:
guard let folded = clickSlice.folded else { return }

defer {
delegate?.jsonPreview(self, didChangeSliceState: slices[realRow], decorator: decorator)
}

decorator.slices[realRow].state = .expand

var isExecution = true
Expand Down

0 comments on commit 656b3c9

Please sign in to comment.