-
Notifications
You must be signed in to change notification settings - Fork 1
Example branch 2 #2
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
Conversation
WalkthroughThis pull request refactors how control flows and events are handled in two packages and updates the publishing script. In the PulsDOMAdapter, the controlFlows property is now a simple one-dimensional boolean array, and several methods have been adjusted—most notably, key comparisons and event dispatch parameters have been streamlined. In the Hook class, conditional checks have been removed to ensure that listener dispatch occurs unconditionally during value updates, and the disabled tracking flag is no longer set. The publish script now omits the recursive flag during publishing. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant DOMAdapter as PulsDOMAdapter
participant Renderer as addParts
Client->>DOMAdapter: render()
DOMAdapter->>Renderer: call addParts(...)
Renderer-->>DOMAdapter: return parts
DOMAdapter-->>Client: return rendered nodes
sequenceDiagram
participant Caller as Caller
participant Hook as Hook Instance
participant Listener as Listener
Caller->>Hook: setValue(newValue)
Hook->>Listener: dispatchListener(oldValue)
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/puls-dom-adapter/src/PulsDOMAdapter.ts(9 hunks)packages/puls-state/src/Hook.ts(2 hunks)publish.sh(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/puls-dom-adapter/src/PulsDOMAdapter.ts
[error] 163-163: Expected a function body, or an expression but instead found 'return'.
Expected a function body, or an expression here.
(parse)
[error] 163-163: expected : but instead found [
Remove [
(parse)
🪛 GitHub Check: build (20)
packages/puls-dom-adapter/src/PulsDOMAdapter.ts
[failure] 163-163:
'{' expected.
[failure] 163-163:
Left side of comma operator is unused and has no side effects.
🪛 GitHub Actions: Run tests
packages/puls-dom-adapter/src/PulsDOMAdapter.ts
[error] 163-163: TS2695: Left side of comma operator is unused and has no side effects.
[error] 164-164: TS2552: Cannot find name 'set'. Did you mean 'Set'?
[error] 164-164: TS7006: Parameter 'el' implicitly has an 'any' type.
[error] 165-165: TS2353: Object literal may only specify known properties, and 'as' does not exist in type 'ValueTransformer'.
[error] 165-165: TS18004: No value exists in scope for the shorthand property 'as'. Either declare one or provide an initializer.
[error] 203-203: TS2345: Argument of type 'any[]' is not assignable to parameter of type 'boolean'.
[error] 212-212: TS2339: Property 'includes' does not exist on type 'boolean'.
[error] 213-213: TS2339: Property 'push' does not exist on type 'boolean'.
[error] 223-223: TS2339: Property 'includes' does not exist on type 'boolean'.
[error] 446-446: TS2551: Property 'addParts' does not exist on type 'PulsDOMAdapter'. Did you mean 'addPart'?
[error] 163-163: TS1005: '{' expected.
[error] 164-164: TS1005: ';' expected.
[error] 165-165: TS1005: ',' expected.
[error] 165-165: TS1005: ',' expected.
[error] 165-165: TS1005: '(' expected.
[error] 166-166: TS1136: Property assignment expected.
🪛 GitHub Actions: Test the build process
packages/puls-dom-adapter/src/PulsDOMAdapter.ts
[error] 163-163: error TS1005: '{' expected.
🔇 Additional comments (2)
packages/puls-state/src/Hook.ts (1)
35-35: LGTM! Simplified listener dispatch logic.The change makes the behavior more predictable by always dispatching listeners when a value is set.
publish.sh (1)
2-2:Details
❓ Verification inconclusive
Verify the impact of removing recursive publish.
The
-rflag has been removed from the publish command. This means packages won't be published recursively, which could affect the publishing process for dependent packages.
🏁 Script executed:
#!/bin/bash # Description: Check for package dependencies cat package.json | jq '.workspaces'Length of output: 80
Action Required: Manually verify multirepo configuration impact.
The shell script failed to locate a root-level
package.json, suggesting the repository may not be structured as a standard single-package project. If you are using workspaces (e.g., via apnpm-workspace.yamlfile) to manage multiple packages, the removal of the-rflag could prevent dependent packages from being published.Please verify that:
- Your project employs a monorepo/workspace setup (check for a
pnpm-workspace.yamlor similar configuration).- Recursive publishing is required to update all dependent packages.
Based on your findings, update the publish command if necessary to ensure all packages are published as intended.
| e.removeEventListener(':dettach', handleDetach); | ||
| e.removeEventListener(':attach', handleAttach); | ||
| (to as ChildNode[]).forEach((innerEl): void => { | ||
| if (!from.includes(innerEl)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in event name.
There's a typo in the event name dettach which should be detach.
Apply this diff to fix the typo:
- e.removeEventListener(':dettach', handleDetach);
+ e.removeEventListener(':detach', handleDetach);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| e.removeEventListener(':dettach', handleDetach); | |
| e.removeEventListener(':detach', handleDetach); |
| test: (value: any) => value === null, | ||
| create: (value: any) => return [this.document.createComment('placeholder')], | ||
| set: (el, value: any) => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix syntax error in placeholder transformer.
The create function has incorrect syntax and is causing build failures.
Apply this diff to fix the syntax:
- create: (value: any) => return [this.document.createComment('placeholder')],
+ create: (value: any) => {
+ return [this.document.createComment('placeholder')]
+ },📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test: (value: any) => value === null, | |
| create: (value: any) => return [this.document.createComment('placeholder')], | |
| set: (el, value: any) => {} | |
| test: (value: any) => value === null, | |
| create: (value: any) => { | |
| return [this.document.createComment('placeholder')] | |
| }, | |
| set: (el, value: any) => {} |
🧰 Tools
🪛 Biome (1.9.4)
[error] 163-163: Expected a function body, or an expression but instead found 'return'.
Expected a function body, or an expression here.
(parse)
[error] 163-163: expected : but instead found [
Remove [
(parse)
🪛 GitHub Check: build (20)
[failure] 163-163:
'{' expected.
[failure] 164-164:
';' expected.
[failure] 163-163:
Left side of comma operator is unused and has no side effects.
[failure] 164-164:
Cannot find name 'set'. Did you mean 'Set'?
[failure] 164-164:
Parameter 'el' implicitly has an 'any' type.
🪛 GitHub Actions: Run tests
[error] 163-163: TS2695: Left side of comma operator is unused and has no side effects.
[error] 164-164: TS2552: Cannot find name 'set'. Did you mean 'Set'?
[error] 164-164: TS7006: Parameter 'el' implicitly has an 'any' type.
[error] 163-163: TS1005: '{' expected.
[error] 164-164: TS1005: ';' expected.
🪛 GitHub Actions: Test the build process
[error] 163-163: error TS1005: '{' expected.
| if (key === ':if' || key === 'else-if' || key === ':else') { | ||
| return this.setConditionFlowAttribute(key, value, parserTag) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix condition check for else-if.
The condition check for else-if is missing the colon prefix.
Apply this diff to fix the condition:
- if (key === ':if' || key === 'else-if' || key === ':else') {
+ if (key === ':if' || key === ':else-if' || key === ':else') {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (key === ':if' || key === 'else-if' || key === ':else') { | |
| if (key === ':if' || key === ':else-if' || key === ':else') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix method name mismatch.
The method addParts doesn't exist. The correct method name is addPart.
Apply this diff to fix the method name:
- return this.parsed.map(p => this.addParts(p)).flat().filter(c => c)
+ return this.parsed.map(p => this.addPart(p)).flat().filter(c => c)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return this.parsed.map(p => this.addParts(p)).flat().filter(c => c) | |
| return this.parsed.map(p => this.addPart(p)).flat().filter(c => c) |
🧰 Tools
🪛 GitHub Actions: Run tests
[error] 446-446: TS2551: Property 'addParts' does not exist on type 'PulsDOMAdapter'. Did you mean 'addPart'?
|
|
||
| export class PulsDOMAdapter extends PulsAdapter<Node[]>{ | ||
| controlFlows: boolean[][] = [] | ||
| controlFlows: boolean[] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the control flow type change.
The controlFlows property type has been changed from boolean[][] to boolean[]. This change affects the logic in setConditionFlowAttribute method where array operations are performed.
🏁 Script executed:
#!/bin/bash
# Description: Check for usage of controlFlows array operations
rg -A 5 'controlFlows\[.*\]' packages/puls-dom-adapter/src/PulsDOMAdapter.tsLength of output: 886
Critical: Revisit controlFlows Type Change Logic
After verifying the usage of controlFlows in PulsDOMAdapter.ts, it appears that the change from boolean[][] to boolean[] is causing a type mismatch. The method setConditionFlowAttribute continues to use array operations on this.controlFlows[this.currentControlFlow] (i.e., calling .includes(true) and .push(value)), which implies that each element of controlFlows is expected to be an array rather than a simple boolean value.
- Action: Either revert the type change back to
boolean[][]or update the logic insetConditionFlowAttribute(and any related methods) to correctly handle a one-dimensional array if that is the intended behavior.
Summary by CodeRabbit