Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/lucky-fans-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@marko/language-server": patch
"@marko/language-tools": patch
"@marko/type-check": patch
"marko-vscode": patch
---

Fix issue with outputting unnecessary const for native tag codegen.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface Input {}
});
{
const $el = Marko._.el("div");
const __marko_internal_rendered_2 = Marko._.renderNativeTag("div")()()({
Marko._.renderNativeTag("div")()()({
/*div*/
});
const __marko_internal_tag_3 = Marko._.resolveTemplate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface Input {}
const $el = Marko._.hoist(() => __marko_internal_hoist__$el);
{
const $el = Marko._.el("div");
const __marko_internal_rendered_1 = Marko._.renderNativeTag("div")()()({
Marko._.renderNativeTag("div")()()({
class: Marko._.interpolated`hello`,
});
const __marko_internal_tag_2 = Marko._.resolveTemplate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export interface Input {}
[Marko._.content /*div*/]: (() => {
{
const searchInput = Marko._.el("input");
const __marko_internal_rendered_3 = Marko._.renderNativeTag(
"input",
)()()({
Marko._.renderNativeTag("input")()()({
type: "search",
});
return () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export interface Input {}
x;
{
const el = Marko._.el("button");
const __marko_internal_rendered_3 = Marko._.renderNativeTag(
"button",
)()()({
Marko._.renderNativeTag("button")()()({
onClick() {
__marko_internal_change__x.x = 2;
__marko_internal_change__x.x++;
Expand Down
4 changes: 3 additions & 1 deletion packages/language-tools/src/extractors/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,9 @@ constructor(_?: Return) {}
}
}

this.#extractor.write(`const ${renderVar} = `);
if (needsHoist || !isHTML) {
this.#extractor.write(`const ${renderVar} = `);
}
}

if (isHTML) {
Expand Down