Deduplicate component resolution probes

This commit is contained in:
udo 2026-07-18 06:46:21 +00:00
parent f745ce9413
commit 0517f06925
2 changed files with 12 additions and 5 deletions

View File

@ -522,8 +522,10 @@ header free-functions are `inline`. The wasm backend exposes only declarations
the caller after a repeated parent invocation. Resolved component paths are
canonical absolute paths: equivalent spellings containing `.` or `..` must
share one source, compile, artifact, and module-cache identity. The compiler
independently enforces the same canonical identity, and persisted failures
are reused only when their recorded source path matches the current request.
independently enforces the same canonical identity. Within one resolution,
identical entry/site bases and identical raw/`.uce` candidate spellings are
probed only once while first-match order is preserved. Persisted failures are
reused only when their recorded source path matches the current request.
`scripts/test_nested_component_props.sh` passes a large prop tree through an
outer component, invokes 300 nested components, and verifies both inner and
caller props are restored. Its warm-request ceiling guards the request-scope

View File

@ -2244,17 +2244,22 @@ private:
if(current_dir != "" && current_dir != entry_dir)
bases.push_back(current_dir + "/");
}
bases.push_back(worker.cfg.site_root + "/");
String site_base = worker.cfg.site_root + "/";
if(std::find(bases.begin(), bases.end(), site_base) == bases.end())
bases.push_back(site_base);
String normalized_file_name = normalize_component_path(file_name);
for(auto& base : bases)
{
std::vector<String> candidates;
candidates.push_back(base + file_name);
candidates.push_back(base + normalize_component_path(file_name));
if(normalized_file_name != file_name)
candidates.push_back(base + normalized_file_name);
if(file_name.rfind("components/", 0) != 0 && base != "")
{
candidates.push_back(base + "components/" + file_name);
candidates.push_back(base + "components/" + normalize_component_path(file_name));
if(normalized_file_name != file_name)
candidates.push_back(base + "components/" + normalized_file_name);
}
for(auto& candidate : candidates)
{