ChatView refactor split out ChatComposer component and some scrolling hooks#985
ChatView refactor split out ChatComposer component and some scrolling hooks#985Ymit24 wants to merge 2 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
It's funny, my PR adding you to the vouched list got merged just half an hour before you put up this PR (great timing!). And great work so far! |
|
Great timing indeed! Thanks for that too btw! I’m hoping this evening I can try and begin some of the “real” work of altering the data flow so all of this extra composer state isn’t being directly accessed by chatview. That might take a bit of time tho lol. Excited to see if others try and do some refactoring of composer subcomponents or other chatview parts, definitely plenty to go around 😅 |
What Changed
relates to #830
Why
In an ongoing effort to refactor ChatView, I pulled out the ChatComposer UI. This doesn't change the behavior of these hooks, just move them. There is still a lot of composer state intertwined in chatview. I wanted to do another structural move first before actually, finally, reworking the state flow. I think it will be easier to review+merge by doing this move first then the refactor, otherwise its hard to see what's changing.
As a quick win, i also pulled out a bunch of scroll related hooks and moved to a custom hook, this just reduces noise in ChatView without changing much. I think there may be more like this we can do in the future. Number 1 goal is just get stuff out of ChatView so more people can independently work on refactoring those sections without conflicting.
Feedback is very much welcomed!
UI Changes
No UI changes here, should be purely technical.
Checklist
Future Work
With this split out, it is now possible to work up and down, so rework data flow between ChatView<->ChatComposer but also work to break out more stuff inside ChatComposer into more sub components.
Note
Extract auto-scroll and composer logic from
ChatViewinto dedicated hook and componentuseMessageListAutoScrollhook that pins scroll to bottom, cancels stickiness on user scroll-up, and reschedules on thread changes or new messages.ChatComposercomponent, accepting provider/model selection, image attachments, pending approvals, and send/interrupt/implement callbacks as props.ChatViewis simplified by replacing inline scroll refs, event handlers, and the composer form block with the new hook and component.Macroscope summarized 88f950d.