Experiment: static vs dynamic parts, and the Slot that lets the caller choose - #56
Open
erykciepiela wants to merge 1 commit into
Open
Experiment: static vs dynamic parts, and the Slot that lets the caller choose#56erykciepiela wants to merge 1 commit into
erykciepiela wants to merge 1 commit into
Conversation
…r choose Scan of all ~45 MDC members recording which parts are static-only, which are dynamic-only, and which want to be both (doc/experiment-static-dynamic-parts.md). Sixteen members have a part a real app would drive from data; the codebase already pays for two of them — iconToggle exists because iconButton's icon can't follow data, and photo-gallery rebuilds its whole image list per album because imageListItem's src/label are static. Prototype: `Slot i a = Absent | Pinned a | Fed (i -> a)` — the three times a part's value can be known. `card` and `topAppBar` converted; every demo compiles unchanged, no new warnings. Pinned stays distinct from Fed (const a) on purpose: only Pinned renders at registration, so the static half of a widget stays viewable before any model exists. Findings recorded in the note: the dynamic case must be named (`fed _.album`) because an instance chain can't commit on an unsolved projection type; Absent can't fold into the slot because node presence is construction-time knowledge; and today's static/dynamic boundary coincides with the `mvu` seam, so a dynamic caption pulls chrome inside it. photo-gallery's app bar now names the open album, which retires its separate headline stage; smoke-tested for in-place text-node updates. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Scan of every MDC member recording which of its parts are static (fixed at construction), dynamic (read from the channel), or want to be both — plus a prototype that lets the caller decide. Full note:
doc/experiment-static-dynamic-parts.md.The scan
Genuinely static: typography, elevations,
cardActions,chipSet,list,listItem,dataRow,dataCell,layoutGrid,divider.Genuinely dynamic: the three progress displays,
snackbar/bannermessages —snackbaris the only component whose text part is dynamic by construction.Want both, only static available — 16 members:
toggleSwitch,filterChip,button,fab,menuItem,menu,card,topAppBar,dialog,simpleDialog,drawer,tooltipiconButton,button,fabselect,radioButton,segmentedButton,tabBarslidermin/max,dataTablecolumns,imageListcolumns,layoutCellspancheckbox's label widget (pinned at{}),imageListItemsrc/label, text-field helper/error text (no path at all)Two of these the codebase already pays for:
iconToggleis an entire component that exists becauseiconButton's icon can't follow data; and photo-gallery couldn't build an image list from data, so it useddisplayed $ dynamic \m -> each …, tearing down and rebuilding the whole list on every album change — two static parts cost a reconciled collection.The API
The staging is already there — construction (config args) → registration (
body, chrome on screen) → feed (with/mvu);body $ wis already the no-data peek andbody $ with sample $ wthe sample-data peek. What was missing is per-part choice of stage:Pinned ais deliberately notFed (const a)— onlyPinnedis visible without data, so the type records what is peekable.Measured
cardandtopAppBarconverted:ConvertOptiontag mechanism.card/topAppBarare no longerOcular(precedent:drawer,attrWith).scripts/smoke/tests/photo-gallery.mjs: the fed title updates its own text node in place — a slot is a channel, not a rebuild.spago testand the full smoke suite pass.headline2 … # tappedstage.Findings
{ caption: _.album }does not typecheck — an instance chain can only commit on a concretefrom, and_.albumis still{ album :: t | r } -> tat conversion time. Hencefed. Arguably a feature: the config record then says out loud which parts wait for data.Absentcan't fold into the slot — whether a part's node exists is construction-time knowledge, unavailable to a function ofi; the three-way split preserves today's behaviour exactly.mvuseam. Every demo writescard {…} $ (pipeline # mvu seed), so chrome is structurally never fed. A dynamic caption forces(card {…} $ pipeline) # mvu seed— the one call-site restructure, visible in the photo-gallery diff.Alternatives considered and why they lost (twin words, widget slots, row promotion), plus follow-ups in value order, are in the note.
🤖 Generated with Claude Code