Refactor Reconciler tests and update path handling logic

- Updated test descriptions in `diff.spec.lua` and `diff.stress.spec.lua` to reflect changes in behavior regarding duplicate-named children in both real and virtual DOM contexts.
- Adjusted assertions to ensure that duplicate-named children are correctly removed or added based on the new matching logic.
- Refactored `hydrate.lua` and `matching.lua` to streamline the matching process by removing unnecessary parameters, enhancing clarity and maintainability.
- Updated metadata references in various test files to include the `.model.json5` extension for consistency in path handling.

These changes improve the accuracy of reconciliation tests and enhance the overall robustness of the Reconciler's path handling logic.
This commit is contained in:
Joe 2026-02-17 04:46:54 -06:00
parent 3ad3c21c01
commit bb9d241253
18 changed files with 129 additions and 94 deletions

View file

@ -114,8 +114,7 @@ local Matching = {}
function Matching.matchChildren(
virtualChildren: { string },
studioChildren: { Instance },
virtualInstances: { [string]: any },
instanceMap: any
virtualInstances: { [string]: any }
)
local matched: { { virtualId: string, studioInstance: Instance } } = {}
local remainingVirtual: { string } = table.clone(virtualChildren)
@ -344,7 +343,7 @@ function Matching._computeChangeCount(
end
-- Recursive: match children and sum costs
local childResult = Matching.matchChildren(validVChildren, studioKids, virtualInstances, nil)
local childResult = Matching.matchChildren(validVChildren, studioKids, virtualInstances)
-- Matched children: recursively score each pair
for _, pair in childResult.matched do