Repository navigation
Leave Vue's reserved attributes out of the split, and select a select's options - #11
Merged
Merged
Conversation
…'s options split_template/2 rendered a static ref or key as an attribute, and passed ref and key to components as props; Vue reserves both and never renders them. It also rendered no selected option for a <select v-model>, with a warning. Each <option> inside one now has a :model slot in its start tag with the select's value and the option's own: its bound :value (the slot's new :option_value), its value attribute, or its text, so a renderer can select it as Vue's server renderer does.
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.
Found through PhoenixVapor, comparing its server render with Vue's own server renderer (
@vue/server-renderer) on the same templates.Reserved attributes
split_template/2printed a staticreforkeyas an attribute (<input ref="search">), and passedrefandkeyto components and root attributes as props. Vue reserves both and never renders them. A bound:keywas already left out; nowrefandkeyare, static or bound, inattributes/4andprops/3.<select v-model>A select's
v-modelproduced a warning and no slot, so a renderer couldn't mark the selected option. Vue's server renderer outputs<option value="b" selected>. Now each<option>inside a<select v-model>, in an<optgroup>or av-fortoo, has a:modelslot in its start tag,tag: "option", carrying::value;:value, as the slot's new:option_valuefield (an addition toencoded_model_slot, regenerated with RustQ);valueattribute;An option outside a
<select v-model>has no slot.PhoenixVapor's side renders
selectedon a match (Vue'slooseEqual, membership formultiple), checked against this branch: the output now matches Vue's forref,ref_for,ref_key,keyand the select.Checks
mix lint(rustq.gen --check, format, credo, ex_dna, reach, dialyzer, cargo fmt, clippy -D warnings) clean;mix test: 137 passed (11 doctests), with new tests for both. PhoenixVapor's suite on this branch: 381 passed.