Skip to content

chore: simplify and clarify frontend hooks, stores, services, and utils#400

Merged
streamer45 merged 5 commits into
mainfrom
devin/1777799296-cleanup-frontend-state-logic
May 3, 2026
Merged

chore: simplify and clarify frontend hooks, stores, services, and utils#400
streamer45 merged 5 commits into
mainfrom
devin/1777799296-cleanup-frontend-state-logic

Conversation

@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor

@staging-devin-ai-integration staging-devin-ai-integration Bot commented May 3, 2026

Summary

Comment simplification and code clarification pass across the frontend state/logic layer as part of the v0.5 pre-release cleanup.

Scope: 53 files across ui/src/hooks/, ui/src/stores/, ui/src/services/, ui/src/utils/, ui/src/nodes/, ui/src/constants/, and ui/src/perf/.

What changed:

  • Removed ~1,400 lines of stale, redundant, or overly verbose comments — module-level docstrings explaining obvious purpose, JSDoc on self-documenting functions, inline comments restating what code obviously does, and leftover AI-iteration comments
  • Kept comments where code is inherently complex: render-budget memoization patterns (compositor atom subscriptions, stable entry refs), SameSite cookie workaround rationale, draft node lifecycle constraints, Playwright DOM-ordering guard, @public Playwright API contract tags, React.memo referential stability warnings
  • Simplified timing.ts constants from multi-paragraph JSDoc to concise single-line comments
  • Condensed single-statement useCallback wrappers to single-line form in useDesignViewModals
  • Fixed an empty catch {} block in services/base.ts that violated the no-empty lint rule

What did NOT change:

  • No exported function signatures, hook return types, store interfaces, or atom definitions were modified
  • No functionality changes — purely comment and formatting cleanup
  • All SPDX license headers preserved
  • Files outside scope untouched (views/, panes/, components/, Layout.tsx, App.tsx, index.tsx, types/, test/)

Review & Testing Checklist for Human

  • Spot-check a few files to verify no behavioral code was accidentally removed along with comments
  • Verify the remaining comments are genuinely useful and not over-trimmed in complex areas (e.g. compositor atom subscription patterns, yamlPipeline.ts edge cases)

Notes

  • All pre-existing lint warnings (complexity in ConfigurableNode.tsx, max-lines in files outside scope) remain unchanged
  • just lint passes with 0 errors; just test passes all 554 tests across 38 test files; just knip-ui passes

Link to Devin session: https://staging.itsdev.in/sessions/b0d3afd0cae0467990a86fd92e6fc3ac
Requested by: @streamer45


Devin Review

Status Commit
🟢 Reviewed 3a5b902
Open in Devin Review (Staging)

streamkit-devin and others added 3 commits May 3, 2026 09:19
…nodes, constants, and perf

Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

Open in Devin Review (Staging)
Debug

Playground

Comment thread ui/src/nodes/CompositorNode.tsx
Comment thread ui/src/perf/index.ts
Comment thread ui/src/nodes/SchemaControls.tsx
Comment on lines 309 to 310
const shouldPublish = state.enablePublish;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

📝 Info: Removed design rationale comments from streamStoreHelpers

Several comments in streamStoreHelpers.ts documented non-obvious design decisions — e.g., why shouldPublish no longer implicitly enables in session mode (old line ~335-338), why screen source health checks look for .video instead of the whole source (old line ~949-951), and why secondary broadcasts are limited to 2. While the code is unchanged, these comments captured architectural decisions that aren't obvious from reading the code alone. The NOTE: Session mode no longer implicitly enables publishing comment near line 309 (new) was particularly important as it documented a deliberate behavioral change from past versions.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Restored the shouldPublish design-decision comment in 56eeebe — condensed to 2 lines explaining that session mode no longer implicitly enables publishing.

Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 3 new potential issues.

Open in Devin Review (Staging)
Debug

Playground

Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot May 3, 2026

Choose a reason for hiding this comment

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

📝 Info: Removal of performance-rationale comments on memoization boundaries

Several removed comments explained why specific useMemo/React.memo boundaries exist — e.g. explaining that useStableEntries returns a stable reference so downstream React.memo components bail out during opacity/rotation drags (ui/src/nodes/compositorNodeEntries.ts), or that ConnectedRotationControl won't re-render when opacity changes due to Jotai's Object.is check (ui/src/nodes/compositorNodeInspector.tsx). The latest commit (3a5b902) partially restored some of these, but many are still reduced. These comments serve as guard rails against future refactors that might accidentally break render performance. Their removal is a documentation quality tradeoff, not a bug.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point — restored a concise memoization rationale on useStableEntries in compositorNodeEntries.ts and a field-level atom subscription comment above the connected controls in compositorNodeInspector.tsx in 3a5b902. These document the render-budget invariants without being verbose.

Comment thread ui/src/nodes/ConfigurableNode.tsx
Comment thread ui/src/services/base.ts Outdated
// In local development it's common to mix `localhost` and `127.0.0.1`. Those are treated as
// different sites by browsers, which breaks cookie-based auth flows. When both sides are
// loopback, rewrite the API hostname to match the current UI hostname.
// Rewrite loopback hostname to match UI so SameSite=Strict cookies work.
Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot May 3, 2026

Choose a reason for hiding this comment

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

📝 Info: Removal of SameSite cookie auth rationale in base.ts

The original comment in ui/src/services/base.ts:26-31 explained the specific browser behavior (SameSite=Strict treats localhost and 127.0.0.1 as different sites) that motivated the loopback hostname rewrite. The replacement comment at lines 11-12 is shorter but still captures the key rationale. The latest commit (3a5b902) further improved this particular comment. No functional risk here — the code is unchanged.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point — expanded the comment to explain why browsers treat localhost and 127.0.0.1 as different sites in 3a5b902.

…aft lifecycle comment

Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Open in Devin Review (Staging)
Debug

Playground

Comment on lines +20 to +32
const handleOpenClearModal = useCallback(() => setShowClearModal(true), []);
const handleCloseClearModal = useCallback(() => setShowClearModal(false), []);
const handleOpenSaveModal = useCallback(() => setShowSaveModal(true), []);
const handleCloseSaveModal = useCallback(() => setShowSaveModal(false), []);
const handleOpenCreateModal = useCallback(() => setShowCreateModal(true), []);
const handleCloseCreateModal = useCallback(() => setShowCreateModal(false), []);
const handleOpenLoadSampleModal = useCallback(() => setShowLoadSampleModal(true), []);
const handleCloseLoadSampleModal = useCallback(() => {
setShowLoadSampleModal(false);
setPendingSample(null);
}, []);

const handleOpenSaveFragmentModal = useCallback(() => {
setShowSaveFragmentModal(true);
}, []);

const handleCloseSaveFragmentModal = useCallback(() => {
setShowSaveFragmentModal(false);
}, []);
const handleOpenSaveFragmentModal = useCallback(() => setShowSaveFragmentModal(true), []);
const handleCloseSaveFragmentModal = useCallback(() => setShowSaveFragmentModal(false), []);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

📝 Info: useDesignViewModals callback reformatting is logically identical

In ui/src/hooks/useDesignViewModals.ts, eight callbacks were reformatted from multi-line useCallback(() => { setX(true); }, []) to single-line useCallback(() => setX(true), []). The logic is identical — arrow functions with a single expression implicitly return the result of setState, which returns void in both forms. The one callback that remained multi-line (handleCloseLoadSampleModal) is the only one with two statements, correctly preserving its block form.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

@streamer45 streamer45 merged commit 8443789 into main May 3, 2026
13 checks passed
@streamer45 streamer45 deleted the devin/1777799296-cleanup-frontend-state-logic branch May 3, 2026 17:35
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.

2 participants