Skip to content

refactor(core): dedupe shader-write tail in elementNode#18

Merged
chiefcll merged 1 commit into
mainfrom
refactor/shader-write-dedup
May 21, 2026
Merged

refactor(core): dedupe shader-write tail in elementNode#18
chiefcll merged 1 commit into
mainfrom
refactor/shader-write-dedup

Conversation

@chiefcll
Copy link
Copy Markdown
Contributor

Summary

Three small cleanups in src/core/elementNode.ts, all behavior-preserving.

  • _writeShaderTarget(target) helper. The rendered/pre-render/DOM-self-assign tail was duplicated between set effects(v) and shaderAccessor. Both copies carried the same // eslint-disable-next-line no-self-assign -- lng.shader is a setter, force style update comment — a real drift hazard. Now there's one home for the trick.
  • Loop fold. The six consecutive if (v.X) parseAndAssignShaderProps('X', v.X, target) calls in set effects(v) collapse to a for over a new EFFECT_SHADER_KEYS constant ('border', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'shadow').
  • Un-export LightningRendererNumberProps. It's referenced one line below where it's declared and nowhere else.

Test plan

  • npm run tsc — clean
  • npm test — 120/120 pass
  • npm run lint — 0 errors (warnings down 10 because the duplicated eslint-disable / formatted blocks collapsed)

Net diff: -31 / +34 lines in one file.

🤖 Generated with Claude Code

- Extract `_writeShaderTarget(target)` to share the rendered/pre-render/DOM
  self-assign tail that was duplicated between `set effects(v)` and
  `shaderAccessor`. The two copies were a real drift hazard since each
  carried the same `// eslint-disable-next-line no-self-assign` comment for
  the DOM-renderer style-refresh trick.
- Replace the six consecutive `if (v.X) parseAndAssignShaderProps(...)` calls
  in `set effects(v)` with a loop over `EFFECT_SHADER_KEYS`.
- Drop the `export` on `LightningRendererNumberProps` — it's only referenced
  one line below where it's declared.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@chiefcll chiefcll merged commit 1873aef into main May 21, 2026
1 check passed
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