Draft
Fix mx-step WC "Step +1" counter not incrementing in section 6.a#151
Conversation
Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix the wc 'Step +1' functionality in index.html notebook
Fix mx-step WC "Step +1" counter not incrementing in section 6.a
Aug 4, 2026
dadhi
requested changes
Aug 5, 2026
| set value(v) { this._value = +v || 0; this.shadowRoot.querySelector('output').textContent = '' + this._value } | ||
| connectedCallback() { | ||
| this.shadowRoot.querySelector('button').onclick = () => this.dispatchEvent(new CustomEvent('step-picked', { detail: { step: this._value + 1 } })) | ||
| this.shadowRoot.querySelector('button').onclick = () => { this._value += 1; this.shadowRoot.querySelector('output').textContent = '' + this._value; this.dispatchEvent(new CustomEvent('step-picked', { detail: { step: this._value } })) } |
Owner
There was a problem hiding this comment.
Why do we need this code? Can we use the dmax for that?
Contributor
Author
There was a problem hiding this comment.
Good point. The manual _value mutation and textContent update are now replaced with a call to this.value = this._value + 1, which reuses the existing value setter that already handles both. The dmax binding data-m-ex:.@wc-step will also drive the setter when the wc-step store updates (via the wc-picked feedback binding), keeping everything in sync.
Co-authored-by: dadhi <39516+dadhi@users.noreply.github.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.
The
mx-stepWeb Component dispatchedstep-pickedwiththis._value + 1on every click but never mutatedthis._value, so every click emittedstep: 1and the counter appeared frozen.Changes
mx-steponclick — incrementthis._valuein-place and update the shadow<output>before dispatching, so consecutive clicks accumulate:mx-stepelement binding — addeddata-m-ex:wc-step@wc-picked="'' + val"to close the feedback loop: when thewc-pickedstore updates from the custom event,wc-stepis also updated, keeping the "WC default value prop"<span>in sync.