Repository navigation
Conversation
The filteredParts predicate was an anonymous closure nested three levels deep inside Share (For -> filter callback), which qlty attributed to Share's own complexity/return-count score. Hoisting it into a standalone function is behavior-preserving and lets the smells report attribute its 8 early returns to the predicate itself.
The data() memo's cost/token/model reducer loop was inlined directly inside Share, adding to its complexity score. Extracting it into a standalone summarizeSession(info, msgs) function is behavior- preserving (same accumulation logic, iterated with for-of instead of an indexed loop since the index was never used).
…tton
The floating scroll-to-bottom button's signals, IntersectionObserver
sentinel, checkScrollNeed logic, and its onMount/onCleanup pair were
all inlined in Share, driving most of its remaining complexity.
useScrollButton() encapsulates the same logic unchanged and returns
{ visible, scrollToBottom, onMouseEnter, onMouseLeave } for the JSX
to wire up directly.
Exports the two functions extracted from Share out of Share.tsx and adds unit tests exercising every branch: each isVisiblePart filter rule (plus a realistic mixed-part integration case) and summarizeSession's cost/ token/model aggregation, last-write-wins fields, and edge cases around missing session info or messages.
…seScrollButton useScrollButton bundled its scroll-visibility decision and repeated "clear this if it's set" cleanup checks inside one closure, which Qlty flagged as high complexity (28) after the earlier Share extractions moved it there. Pulling the pure show/hide predicate and a shared disposeIfSet(value, dispose) helper out to top-level functions drops useScrollButton out of the Qlty report entirely (file total complexity 144 -> 126) without introducing a new flagged function. Behavior is unchanged; only where the branches live changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #2
Type of change
What does this PR do?
This PR creates a custom /scotty command which displays an ASCII art of scotty. I created a new command in App.tsx and created a new component for it that would be displayed whenever the command was run.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
Checklist
If you do not follow this template your PR will be automatically rejected.