{"record":{"id":"33d4a4c13a9b57ea","repo":"leptos-rs/leptos","slug":"hot-reloading-building-children-encountered","errorCode":null,"errorMessage":"[HOT RELOADING] Building children, encountered","messagePattern":"\\[HOT RELOADING\\] Building children, encountered","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"leptos_hot_reload/src/patch.js","lineNumber":430,"sourceCode":"            if (walker.currentNode.textContent.trim() == endMarker) {\n              depth--;\n            } else if (walker.currentNode.textContent.trim() == componentName) {\n              depth++;\n            }\n\n            if (depth == 0) {\n              break;\n            }\n          }\n          let end = walker.currentNode;\n          actualChildren.push({\n            type: \"component\",\n            start,\n            end,\n          });\n        }\n      } else {\n        console.warn(\n          \"[HOT RELOADING] Building children, encountered\",\n          walker.currentNode,\n        );\n      }\n    }\n    return actualChildren;\n  }\n\n  function childAtPath(element, path) {\n    if (path.length == 0) {\n      return element;\n    } else if (element.children) {\n      const next = element.children[path[0]],\n        rest = path.slice(1);\n      return childAtPath(next, rest);\n    } else if (path == [0]) {\n      return element;\n    } else if (element.start && element.end) {","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/leptos_hot_reload/src/patch.js#L412-L448","documentation":"While walking the DOM to build the child model used for patching, buildActualChildren encountered a node whose type it does not handle (only ELEMENT, TEXT, and the known COMMENT markers are supported). The node is skipped (not added to actualChildren), which can shift child indexes and cause subsequent patches to target the wrong element or fail path resolution.","triggerScenarios":"A comment node whose textContent is not a recognized marker (hot-reload|*, <() />, <DynChild>, <>, or a `<Component>` style marker) appears as a direct child inside a patched range — e.g. framework-internal comments, conditional comments, or comments injected by extensions/other tooling.","commonSituations":"Third-party scripts or browser extensions injecting comment nodes; mixing leptos hot-reload markers with other leptos debug comments; SSR/hydration leftovers inside the patch range.","solutions":["Inspect the logged walker.currentNode to identify the unexpected comment and its source.","Disable browser extensions or scripts that inject comments into app DOM during development.","Extend buildActualChildren's comment handling if your tooling legitimately emits its own markers.","Keep patched subtrees free of foreign nodes (wrap third-party widgets in components with markers)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check for foreign comments inside a component's DOM before relying on hot reload:\nconst foreign = [...container.childNodes]\n  .filter(n => n.nodeType === Node.COMMENT_NODE &&\n    !n.textContent.trim().startsWith('hot-reload|') &&\n    !['<() />', '<DynChild>', '<>', '</>'].includes(n.textContent.trim()));\nif (foreign.length) console.warn('foreign comment nodes present', foreign);","typeGuard":"function isRecognizedMarker(comment) {\n  const t = comment.textContent.trim();\n  return t.startsWith('hot-reload|') || t === '<() />' ||\n    t === '<DynChild>' || t === '</DynChild>' || t === '<>' || t === '</>' ||\n    /^<[^/].*>$/.test(t);\n}","tryCatchPattern":null,"preventionTips":["Disable DOM-injecting browser extensions during development.","Keep third-party widgets wrapped in marked components.","Log unexpected nodes once and extend buildActualChildren if the marker is legitimate."],"tags":["hot-reload","dom-walker","leptos"],"backgroundTag":"unrecognized-dom-node-skipped","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}