- Notifications
You must be signed in to change notification settings - Fork 23
feat(autofix-result): refactor logstream handling with modifier #3188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rohitpaulk wants to merge 5 commits into main Choose a base branch from refactor-autofixresult-logstream-handling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Bundle ReportChanges will decrease total bundle size by 2.41kB (-0.01%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: client-array-pushAssets Changed:
Files in
|
Replace manual logstream management in AutofixResult component with a new `logstream-did-update` modifier that handles subscription lifecycle automatically. This simplifies the component by removing explicit setup, teardown, and state syncing of Logstream instances. Update the template to use the modifier for logstream updates and track logstream content reactively. This ensures better separation of concerns and reduces boilerplate. Add `logstream-did-update` modifier that encapsulates subscribing and unsubscribing to logstreams and invokes a callback on updates. Overall, these changes improve code clarity, correctness, and maintainability around logstream update handling.
Eliminate early return on isSubscribed in subscribeTask to allow resubscription logic to proceed. This change fixes an issue where the subscription could not be re-established once terminated, improving reliability of the log stream handling.
Register a destructor for the modifier to ensure the Logstream is properly unsubscribed when the modifier is destroyed. Replace ad-hoc unsubscribe logic in modify() with a dedicated cleanup function. Use a lambda callback to invoke the provided callback with the current logstream, removing unnecessary stored callback references and improving code clarity.
Remove the unused `action` import from the logstream-did-update modifier to clean up the code and avoid unnecessary dependencies.
Set the logstream property to undefined during cleanup to prevent potential memory leaks or stale references. Also, adjust the callback invocation in modify for clearer structure while keeping the same behavior.
68646db
to 06a96d1
Compare 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.
Replace manual logstream management in AutofixResult component with a
new
logstream-did-update
modifier that handles subscription lifecycleautomatically. This simplifies the component by removing explicit setup,
teardown, and state syncing of Logstream instances.
Update the template to use the modifier for logstream updates and track
logstream content reactively. This ensures better separation of concerns
and reduces boilerplate.
Add
logstream-did-update
modifier that encapsulates subscribing andunsubscribing to logstreams and invokes a callback on updates.
Overall, these changes improve code clarity, correctness, and maintainability
around logstream update handling.
Note
Extract a
logstream-did-update
modifier to manage logstream subscriptions and simplifyAutofixResult
to consume tracked content.autofix-result.hbs
): Replace manual lifecycle modifiers with{{logstream-did-update this.handleLogstreamDidUpdate @autofixRequest.logstreamId}}
; renderAnsiStream
from trackedthis.logstreamContent
.autofix-result.ts
): Remove manualLogstream
management (subscribe/unsubscribe and element hooks); addhandleLogstreamDidUpdate
to setlogstreamContent
and reload theautofixRequest
; drop injectedstore
/actionCableConsumer
usage.app/modifiers/logstream-did-update.ts
: encapsulatesLogstream
subscription lifecycle, cleans up on re-run/destroy, and invokes a callback on updates; registers in Glint registry.app/utils/logstream.ts
: remove earlyisSubscribed
guard insubscribeTask
to allow re-subscription after cleanup.Written by Cursor Bugbot for commit 06a96d1. This will update automatically on new commits. Configure here.