Skip to content

Commit

Permalink
fix: ensure node exists before clearing on error
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Feb 26, 2024
1 parent 9c1d247 commit 9567d57
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
id="GENERATED-2"
>
<script>
document.getElementById("s0-9-0").textContent=""
(function(e){if(e)e.textContent=""})(document.getElementById("s0-9-0"))
</script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
id="GENERATED-3"
>
<script>
document.getElementById("s0-10-0").textContent=""
(function(e){if(e)e.textContent=""})(document.getElementById("s0-10-0"))
</script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
id="GENERATED-5"
>
<script>
document.getElementById("s0-10-0").textContent=""
(function(e){if(e)e.textContent=""})(document.getElementById("s0-10-0"))
</script>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
id="GENERATED-6"
>
<script>
document.getElementById("s0-11-0").textContent=""
(function(e){if(e)e.textContent=""})(document.getElementById("s0-11-0"))
</script>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
test_html for slot_1
</p>
<script>
document.getElementById("s0-9-0").textContent=""
(function(e){if(e)e.textContent=""})(document.getElementById("s0-9-0"))
</script>
</div>
6 changes: 1 addition & 5 deletions src/node_modules/@internal/micro-frame-component/node.marko
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ static async function fetchStream(input, out) {
<@catch|err|>
<if(input.catch)>
<!-- Remove everything in the container and render our catch handler -->
<script>
document.getElementById(
${JSON.stringify(component.id)},
).textContent = "";
</script>
<script>(function(e){if(e)e.textContent=""})(document.getElementById(${JSON.stringify(component.id)}))</script>
<${input.catch}(err)/>
</if>
<else>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ {
</@then>
<@catch|e|>
$ finishLoading && finishLoading();
<script>document.getElementById(${JSON.stringify(component.id)}).textContent=""</script>
<script>(function(e){if(e)e.textContent=""})(document.getElementById(${JSON.stringify(component.id)}))</script>
<${input.catch}(e)/>
</@catch>
</await>
Expand Down

0 comments on commit 9567d57

Please sign in to comment.