Skip to content

refactor: introduce EditControlFactory and use BaseOpticalElementView in _setupView - #10

Merged
veillette merged 1 commit into
mainfrom
claude/fix-model-view-separation-ezVmh
Mar 17, 2026
Merged

veillette merged 1 commit into
mainfrom
claude/fix-model-view-separation-ezVmh

Conversation

@veillette

Copy link
Copy Markdown
Collaborator

EditContainerNode previously imported 14 concrete model classes and contained
a 580-line instanceof chain (_buildControls). This is moved into a new
EditControlFactory.ts — the intentional single coupling point between model
classes and their edit-panel controls, mirroring OpticalElementViewFactory.

EditContainerNode now has zero direct model-class imports; it delegates to
buildEditControls() and uses the returned refreshCallback.

SimScreenView._setupView had a 7-branch instanceof chain where every branch
assigned the same onRebuild callback. Replaced with a single
instanceof BaseOpticalElementView check, which is correct by construction
since all concrete views extend that base class.

https://claude.ai/code/session_012UtbyBmcxQsUwyQuWza6D8

… in _setupView

EditContainerNode previously imported 14 concrete model classes and contained
a 580-line instanceof chain (_buildControls). This is moved into a new
EditControlFactory.ts — the intentional single coupling point between model
classes and their edit-panel controls, mirroring OpticalElementViewFactory.

EditContainerNode now has zero direct model-class imports; it delegates to
buildEditControls() and uses the returned refreshCallback.

SimScreenView._setupView had a 7-branch instanceof chain where every branch
assigned the same onRebuild callback. Replaced with a single
instanceof BaseOpticalElementView check, which is correct by construction
since all concrete views extend that base class.

https://claude.ai/code/session_012UtbyBmcxQsUwyQuWza6D8
@veillette
veillette merged commit 52e4ec7 into main Mar 17, 2026
1 check failed
@veillette
veillette deleted the claude/fix-model-view-separation-ezVmh branch March 17, 2026 12:57
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.

2 participants