mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
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:
parent
3ad3c21c01
commit
bb9d241253
18 changed files with 129 additions and 94 deletions
|
|
@ -10,7 +10,7 @@ use rbx_dom_weak::{
|
|||
|
||||
use crate::{multimap::MultiMap, RojoRef};
|
||||
|
||||
use super::{InstanceMetadata, InstanceSnapshot};
|
||||
use super::{InstigatingSource, InstanceMetadata, InstanceSnapshot};
|
||||
|
||||
/// An expanded variant of rbx_dom_weak's `WeakDom` that tracks additional
|
||||
/// metadata per instance that's Rojo-specific.
|
||||
|
|
@ -291,8 +291,19 @@ impl RojoTree {
|
|||
pub fn filesystem_name_for(&self, id: Ref) -> String {
|
||||
if let Some(meta) = self.metadata_map.get(&id) {
|
||||
if let Some(source) = &meta.instigating_source {
|
||||
if let Some(name) = source.path().file_name().and_then(|f| f.to_str()) {
|
||||
return name.to_string();
|
||||
match source {
|
||||
InstigatingSource::Path(_) => {
|
||||
if let Some(name) = source.path().file_name().and_then(|f| f.to_str()) {
|
||||
return name.to_string();
|
||||
}
|
||||
}
|
||||
InstigatingSource::ProjectNode { .. } => {
|
||||
// Project-sourced instance: use instance name, not the
|
||||
// project file path (which would be e.g. "default.project.json5").
|
||||
if let Some(inst) = self.inner.get_by_ref(id) {
|
||||
return inst.name.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue