refactor(core): dedupe shader-write tail in elementNode#18
Merged
Conversation
- 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>
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
Three small cleanups in
src/core/elementNode.ts, all behavior-preserving._writeShaderTarget(target)helper. The rendered/pre-render/DOM-self-assign tail was duplicated betweenset effects(v)andshaderAccessor. Both copies carried the same// eslint-disable-next-line no-self-assign -- lng.shader is a setter, force style updatecomment — a real drift hazard. Now there's one home for the trick.if (v.X) parseAndAssignShaderProps('X', v.X, target)calls inset effects(v)collapse to aforover a newEFFECT_SHADER_KEYSconstant ('border', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'shadow').LightningRendererNumberProps. It's referenced one line below where it's declared and nowhere else.Test plan
npm run tsc— cleannpm test— 120/120 passnpm 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