Bug
When a CREATE PAGE precedes a CREATE SNIPPET in the same script, the snippet reference fails even though both are in the script. The reverse order (snippet first, then page) works.
Root cause
resolveSnippetRef in mdl/executor/cmd_pages_builder_input.go queries the backend directly and never checks ctx.Cache.createdSnippets. By contrast, resolveMicroflow and resolvePageRef both check the in-session cache first, so forward references to microflows and pages within the same script work correctly.
The fix is a single cache lookup in resolveSnippetRef before falling through to the backend query — identical to the pattern already used in the other two resolver functions.
Reproduction
-- This order fails: page references snippet not yet in the DB
create page MyModule.Overview (...) {
snippetcall MyModule.Header;
};
create snippet MyModule.Header (...) { ... }
-- This order succeeds
create snippet MyModule.Header (...) { ... }
create page MyModule.Overview (...) {
snippetcall MyModule.Header;
};
Affected files
mdl/executor/cmd_pages_builder_input.go — resolveSnippetRef function
Bug
When a
CREATE PAGEprecedes aCREATE SNIPPETin the same script, the snippet reference fails even though both are in the script. The reverse order (snippet first, then page) works.Root cause
resolveSnippetRefinmdl/executor/cmd_pages_builder_input.goqueries the backend directly and never checksctx.Cache.createdSnippets. By contrast,resolveMicroflowandresolvePageRefboth check the in-session cache first, so forward references to microflows and pages within the same script work correctly.The fix is a single cache lookup in
resolveSnippetRefbefore falling through to the backend query — identical to the pattern already used in the other two resolver functions.Reproduction
Affected files
mdl/executor/cmd_pages_builder_input.go—resolveSnippetReffunction