check against hooks inside of root component#5971
Merged
adhami3310 merged 1 commit intomainfrom Nov 13, 2025
Merged
Conversation
CodSpeed Performance ReportMerging #5971 will not alter performanceComparing Summary
|
masenf
approved these changes
Nov 12, 2025
Contributor
Greptile OverviewGreptile SummaryThis PR adds validation to prevent stateful components or hooks from being used in the document root (specifically head components). The change stores the HTML component before returning it and checks if it contains any hooks using Key changes:
Potential issue identified:
Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant create_document_root
participant Html.create
participant html_component
participant _get_all_hooks
User->>create_document_root: Calls with head_components
create_document_root->>Html.create: Creates HTML structure with Head and Body
Html.create-->>html_component: Returns HTML component tree
create_document_root->>html_component: _get_all_hooks()
html_component->>_get_all_hooks: Traverses children recursively
_get_all_hooks-->>html_component: Returns dict of hooks
alt hooks found
html_component-->>create_document_root: Non-empty dict
create_document_root->>User: Raises ValueError
else no hooks
html_component-->>create_document_root: Empty dict
create_document_root->>User: Returns html_component
end
|
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.
No description provided.