chore(fast-html): use @microsoft/fast-build to build observer-map fixture#7388
Draft
chore(fast-html): use @microsoft/fast-build to build observer-map fixture#7388
Conversation
This was referenced Apr 6, 2026
Collaborator
Author
2e0e8b6 to
c4f3083
Compare
janechu
added a commit
that referenced
this pull request
Apr 8, 2026
…ssions (#7394) # Pull Request ## 📖 Description Fixes two gaps in the `microsoft-fast-build` Rust renderer related to data access in template expressions: 1. **Array `.length` support** — `{{items.length}}` now resolves correctly. Previously, `get_nested_property` tried to parse `"length"` as a numeric array index, which always failed and returned a `MissingState` error. A special case now returns the array's length as a number. 2. **JSON literal attribute values** — Custom element attributes can now accept JSON array and object literals directly (e.g. `items='["a","b","c"]'` or `config='{"title":"Hello"}'`). Previously, these were passed through as raw strings, causing child templates that iterated or accessed nested values to fail. ### 🎫 Issues * Helps unblock [#7390](#7390) — deep-merge fixture uses `{{users.length}}` and `{{user.orders.length}}` * Helps unblock [#7388](#7388) — observer-map fixture uses `{{user.posts.length}}` ## 📑 Test Plan New Rust integration tests added: - `tests/bindings.rs` — `test_array_length`, `test_array_length_empty`, `test_array_length_nested` - `tests/f_when.rs` — `test_when_array_length_gt_zero`, `test_when_array_length_zero` - `tests/custom_elements.rs` — `test_custom_element_json_array_attr`, `test_custom_element_empty_array_attr`, `test_custom_element_json_object_attr` All existing and new tests pass (`cargo test`). ## ✅ Checklist ### General - [x] I have included a change request file using `$ npm run change` - [x] I have added tests for my changes. - [x] I have tested my changes. - [x] I have updated the project documentation to reflect my changes. - [x] I have read the [CONTRIBUTING](https://github.com/microsoft/fast/blob/main/CONTRIBUTING.md) documentation and followed the [standards](https://github.com/microsoft/fast/blob/main/CODE_OF_CONDUCT.md#our-standards) for this project.
1e4cc26 to
ef17c88
Compare
5 tasks
janechu
added a commit
that referenced
this pull request
Apr 9, 2026
…er (#7410) # Pull Request ## 📖 Description Fixes a bug in the hand-rolled JSON string parser (`json.rs`) where non-ASCII characters were corrupted during parsing. The `parse_string` function advanced through the input byte-by-byte and used `b as char` for unescaped characters. For ASCII bytes this is correct, but for multi-byte UTF-8 sequences it casts each byte independently to a Unicode scalar, producing garbage. For example, ⭐ (U+2B50, UTF-8: `0xE2 0xAD 0x90`) was rendered as `â` (U+00E2) followed by two invisible control characters. The fix determines the byte-length of each UTF-8 sequence from the leading byte, reads the full sequence, and decodes it with `std::str::from_utf8`. ASCII bytes (< 0x80) continue to use the fast `b as char` path. This explains the `â SELECTED` corruption observed in the observer-map fixture output (issue seen in #7388). ## 📑 Test Plan New unit tests in `json.rs`: - `test_parse_string_with_emoji` — ⭐ round-trips correctly - `test_parse_string_with_multibyte_chars` — 2-byte (é), 3-byte (✓), and 4-byte (🎉) sequences - `test_parse_string_emoji_in_object` — emoji values inside a JSON object New integration tests in `tests/bindings.rs`: - `test_binding_emoji_from_state` — emoji from JSON state renders correctly in a binding - `test_binding_emoji_literal_in_template` — emoji in template literal text is preserved verbatim - `test_binding_multibyte_chars` — general multi-byte character round-trip All existing tests pass (`cargo test`). ## ✅ Checklist ### General - [ ] I have included a change request file using `$ npm run change` - [x] I have added tests for my changes. - [x] I have tested my changes. - [x] I have updated the project documentation to reflect my changes. - [x] I have read the [CONTRIBUTING](https://github.com/microsoft/fast/blob/main/CONTRIBUTING.md) documentation and followed the [standards](https://github.com/microsoft/fast/blob/main/CODE_OF_CONDUCT.md#our-standards) for this project.
…ture Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…p element chain Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ry attrs
Rebase onto main (includes all previous fixtures up to performance-metrics).
Resolved build-fixtures.js conflict by appending 'observer-map'.
Remove redundant {{binding}} attrs where property name matches state.json key
(users, stats, a, x, groups, value1, value2). Change items="{{simpleItems}}"
to :items="{{simpleItems}}" since 'simpleItems' remaps to 'items'. Keep
selected-user-id="{{selectedUserId}}" as the HTML attr name differs from the
JS property name.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bserver-map entry Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…element Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Change all camelCase property/state keys to lowercase in state.json, entry.html, templates.html, and main.ts: - simpleItems → simpleitems - selectedUserId → selecteduserid (remove duplicate key from state.json) - totalUsers → totalusers - activeUsers → activeusers - loadTime → loadtime - renderTime → rendertime Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pInternalTestElement Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Element Keep property declarations on ObserverMapInternalTestElement without initial values so they are set via template binding from the parent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tElement Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…InternalTestElement Let observerMap: all handle change detection for these properties, including deep nested mutations after replacement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pTestElement Add simpleitems, value1, value2, totalusers, metrics properties. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… and x=undefined on class Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6997b47 to
dc0420d
Compare
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.
Pull Request
📖 Description
Migrates the
observer-mapfixture in@microsoft/fast-htmlto be built by@microsoft/fast-build(the Rust/WASM SSR tool), consistent with other fixture migrations in this series.Key changes:
"observer-map"to thebuild-fixtures.jsfixture listentry.html,state.json, andtemplates.htmlfor the fixture{{binding}}attrs on entry elements where the property name already matches the state.json key (root state is passed implicitly)itemsvia:items="{{simpleItems}}"since the state key (simpleItems) differs from the property name (items)selected-user-id="{{selectedUserId}}"since the HTML attribute name differs from the JS property nameindex.htmlvianpm run build:fixtures📑 Test Plan
All existing tests pass. The fixture builds successfully via
npm run build:fixtures.✅ Checklist
General
$ npm run change⏭ Next Steps
Continue migrating remaining fixtures to use
@microsoft/fast-build.