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.
Description
Add a new clause in the
updateNode
render loop which determines scope components to be equivalent if their source is identical.Motivation and Context
The ability to declare a component inline allows for ad-hoc state capture without the rigmarole of breaking out to define a component elsewhere, determine what contextual reference access it needs, write the
attrs
interface accordingly, and then invoke it at call-site. In fact it facilitates iterative component development by enabling authors to experiment with component logic while benefiting from full call-site context reference access – leaving restrictive interface design as a formal 'ejection' exercise rather than a constant site of friction.The internal logic determining equivalence relies on
oldTag.toString() === tag.toString
. Object and class components do not have as straightforward source-sniffing APIs, and the idiomatic style of OOP component-based application design means there is less benefit to the inter-scope access inline components provide.How Has This Been Tested?
I've written a new test module but – strangely – these only pass if I run it alone, ie
npm run test:js ./render/test-inlineComponent.js
; maybe it's something to do with my slap-dash global Mithril instantiation at the top of the test file?Types of changes
Checklist:
docs/changelog.md