Skip to content

feat(core): shared gsapCascade helper + server-delete GSAP cascade (WS-E/2)#1566

Open
vanceingalls wants to merge 1 commit into
mainfrom
ws-e2-gsap-cascade-shared-helper
Open

feat(core): shared gsapCascade helper + server-delete GSAP cascade (WS-E/2)#1566
vanceingalls wants to merge 1 commit into
mainfrom
ws-e2-gsap-cascade-shared-helper

Conversation

@vanceingalls

Copy link
Copy Markdown
Collaborator

What

Brief description of the change.

Why

Why is this change needed?

How

How was this implemented? Any notable design decisions?

Test plan

How was this tested?

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)

…S-E/2)

New packages/core/src/parsers/gsapCascade.ts lifts selectorMatchesId /
collectSubtreeHfIds / cascadeRemoveAnimations / cascadeRemoveAnimationsFromDocument
from mutate.ts (canonical subtree-aware impl), typed with minimal structural
interfaces so it works for both linkedom and DOMParser elements.

sdk/mutate.ts and core/htmlParser.ts now import from the core helper; their
local duplicate cascade implementations are deleted.

sourceMutation.removeElementFromHtml now collects the full subtree of
data-hf-id values before element.remove(), then calls
cascadeRemoveAnimationsFromDocument — eliminating dangling GSAP tweens when
the studio server-delete route removes an element with animated children.

Tests in sourceMutation.test.ts cover: leaf delete, parent-with-children
(all subtree tweens stripped), positional renumbering (re-parse loop), non-gsap
scripts untouched, element with no tweens.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions

Copy link
Copy Markdown

Fallow audit report

Found 14 findings.

Dead code (1)
Severity Rule Location Description
major fallow/unused-class-member packages/sdk/src/engine/mutate.ts:135 Class member 'UnsupportedOpError.code' is never referenced
Duplication (4)
Severity Rule Location Description
minor fallow/code-duplication packages/core/src/studio-api/helpers/sourceMutation.test.ts:471 Code clone group 1 (9 lines, 2 instances)
minor fallow/code-duplication packages/core/src/studio-api/helpers/sourceMutation.test.ts:538 Code clone group 1 (9 lines, 2 instances)
minor fallow/code-duplication packages/sdk/src/engine/mutate.ts:532 Code clone group 2 (44 lines, 2 instances)
minor fallow/code-duplication packages/sdk/src/engine/mutate.ts:602 Code clone group 2 (44 lines, 2 instances)
Health (9)
Severity Rule Location Description
minor fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:29 'getElementType' has CRAP score 43.1 (threshold: 30.0, cyclomatic 12)
minor fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:52 'getElementName' has CRAP score 31.6 (threshold: 30.0, cyclomatic 10)
major fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:81 'parseResolutionFromCss' has CRAP score 71.3 (threshold: 30.0, cyclomatic 16)
minor fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:116 'parseResolutionFromHtml' has CRAP score 37.1 (threshold: 30.0, cyclomatic 11)
major fallow/high-complexity packages/core/src/parsers/htmlParser.ts:157 'parseHtml' has cyclomatic complexity 23 (threshold: 20) and cognitive complexity 25 (threshold: 15)
critical fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:179 '<arrow>' has CRAP score 482.4 (threshold: 30.0, cyclomatic 45)
minor fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:490 '<arrow>' has CRAP score 37.1 (threshold: 30.0, cyclomatic 11)
major fallow/high-complexity packages/core/src/parsers/htmlParser.ts:513 'updateElementInHtml' has cyclomatic complexity 26 (threshold: 20) and cognitive complexity 33 (threshold: 15)
minor fallow/high-crap-score packages/core/src/parsers/htmlParser.ts:723 '<arrow>' has CRAP score 43.1 (threshold: 30.0, cyclomatic 12)

Generated by fallow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant