Add keyed reactive components - #5
Merged
Merged
Conversation
Allow repeated component names behind signed keys, pass safe JSON locals through initial and refresh authorization, and add revision-fenced Turbo morph refreshes without broadcasting personalized HTML.
Greptile SummaryThe PR adds keyed reactive components and an opt-in morph refresh path while retaining the existing unkeyed replacement behavior and compatibility with older component tokens.
Confidence Score: 5/5The PR appears safe to merge; no concrete blocking defect or independently actionable non-blocking issue remains. Key identity, signed registration fields, authorization arguments, refresh routing, and actor revision ordering remain consistent across initial rendering, reconnect, invalidation, and HTTP refresh paths. Important Files Changed
Sequence DiagramsequenceDiagram
participant View as Rails View
participant Cable as ActorChannel
participant Browser as Refresh Element
participant Endpoint as ComponentsController
participant Policy as authorize_query
View->>View: Render keyed component and signed registration
View-->>Browser: Initial turbo-frame and module
Cable-->>Browser: Append keyed refresh invalidation
Browser->>Browser: Abort superseded request
Browser->>Endpoint: Same-origin fetch with signed token
Endpoint->>Policy: Authorize component, key, locals, dependencies
Policy-->>Endpoint: Allow
Endpoint-->>Browser: Latest turbo-frame with actor revision
Browser->>Browser: Compare response and current revisions
Browser->>Browser: Apply scoped Turbo morph if newer
Reviews (1): Last reviewed commit: "feat: add keyed reactive components" | Re-trigger Greptile |
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.
Summary
Why
Large actor-backed views currently have to choose between one coarse component or many uniquely named partials. Keyed components let applications reuse one conventional partial for repeated entities while retaining independent observable dependencies and revision tracking.
Morph refreshes keep personalized HTML request-time and authorized. Cable still carries only invalidation metadata; a gem-owned browser element fetches the signed endpoint with normal cookies and applies newer responses through Turbo's scoped morph operation.
API
Correctness and security
(component name, key)is the subscription and DOM identityauthorize_queryreceives signed keys and locals on every initial and refresh renderValidation
bundle exec rakenode --check app/assets/javascripts/solid_objects/component_refresh.jssolid_objects-0.5.0.gemand verified the browser module is packaged