Skip to content

refactor(web): split editor with execution componet into specialized …#114

Merged
andrewmelchor merged 3 commits intomainfrom
refactor(web)/editor-execution
Mar 4, 2026
Merged

refactor(web): split editor with execution componet into specialized …#114
andrewmelchor merged 3 commits intomainfrom
refactor(web)/editor-execution

Conversation

@andrewmelchor
Copy link
Copy Markdown
Member

Summary

Splits the monolithic EditorWithExecution component (373 lines) into focused, single-responsibility components with reusable hooks.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ab5e5d852

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 4, 2026

Greptile Summary

This PR successfully splits the monolithic 373-line EditorWithExecution component into focused, single-responsibility pieces: a lightweight file-type router, two specialized editor components (HttpEditorWithExecution, ScriptEditorWithExecution), and two reusable hooks (useEditorPanelState, useHttpRequestWorkspace). The refactoring preserves all original behavior and incidentally fixes a pre-existing bug where ResizableSplitPane-triggered collapse changes were not persisted to localStorage (the old code passed the raw signal setter to onCollapseChange, bypassing saveCollapsedState; the new setCollapsedWithPersistence wraps every write).

Key observations:

  • useHttpRequestWorkspace exposes validateAndAdjustIndex in its public actions API, but this function is only invoked by an internal createEffect — exposing it as a public action widens the API surface unnecessarily and could invite incorrect external calls.
  • useHttpRequestWorkspace includes a getFileType guard that is unreachable in practice, since the hook is exclusively instantiated from HttpEditorWithExecution which only mounts for HTTP files. This redundant check duplicates the parent component's contract and could mislead future readers.
  • createSimpleContext is introduced but not yet consumed in this PR; the implementation is sound for the .tsx context where JSX compiles when={isReady()} to a reactive getter.

Confidence Score: 4/5

  • This PR is safe to merge — it's a well-structured refactor with no behavioral regressions and one incidental bug fix, though two minor API-design issues remain in useHttpRequestWorkspace.
  • All original logic is faithfully preserved across the split components; the only deductions are two minor API-design issues in useHttpRequestWorkspace (unnecessarily exposed internal function and a dead-code guard), neither of which affects runtime behavior. Both should be addressed before the hook is reused in Phase 4 context work.
  • packages/web/src/hooks/useHttpRequestWorkspace.ts — minor public API cleanup recommended before this hook is reused in Phase 4 context work.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["EditorWithExecution\n(path prop)"] -->|"fileType === 'http'"| B["HttpEditorWithExecution"]
    A -->|"fileType === 'script' | 'test'"| C["ScriptEditorWithExecution"]

    B --> D["useHttpRequestWorkspace\n(requests, selection, drafts, actions)"]
    B --> E["useEditorPanelState\n(collapsed, setCollapsed, toggle)"]
    B --> F["useObserver / useWorkspace\n/ useConnection"]

    C --> E
    C --> G["useObserver / useWorkspace\n/ useScriptRunner / useTestRunner"]

    D --> H["useRequestParseDetails"]
    D --> I["useRequestHeaderDraftController"]
    D --> J["useRequestBodyDraftController"]

    E --> K[("localStorage\ntreq:editor:resultsPanelCollapsed")]
Loading

Last reviewed commit: b3b83e8

@andrewmelchor andrewmelchor merged commit f265652 into main Mar 4, 2026
1 check passed
@andrewmelchor andrewmelchor deleted the refactor(web)/editor-execution branch March 4, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant