~repos /gromer

#golang#htmx#ssr

git clone https://pyrossh.dev/repos/gromer.git

gromer is a framework and cli to build multipage web apps in golang using htmx and alpinejs.


164f0dc7 Peter John

3 years ago
fix bug
Files changed (2) hide show
  1. gsx/gsx.go +3 -2
  2. gsx/gsx_test.go +3 -3
gsx/gsx.go CHANGED
@@ -9,7 +9,6 @@ import (
9
9
  "runtime"
10
10
  "strings"
11
11
 
12
- "github.com/alecthomas/repr"
13
12
  "golang.org/x/net/html"
14
13
  "golang.org/x/net/html/atom"
15
14
  )
@@ -296,7 +295,9 @@ func populateComponent(ctx Html, comp ComponentFunc, n *html.Node, remove bool)
296
295
  if n.FirstChild != nil && remove {
297
296
  n.RemoveChild(n.FirstChild)
298
297
  }
298
+ if !remove {
299
- repr.Println(compNode.String(), compNode.FirstChild.Data)
299
+ populate(ctx, newChild)
300
+ }
300
301
  populateChildren(compNode.FirstChild, newChild)
301
302
  }
302
303
  return compNode.Node
gsx/gsx_test.go CHANGED
@@ -103,17 +103,17 @@ func TestFor(t *testing.T) {
103
103
  <ol x-for="todo in todos">
104
104
  <li id="todo-1" class="completed">
105
105
  <div class="view"><span>My first todo</span><span>My first todo</span></div>
106
- <div class="todo-panel"><span>&lt;nil&gt;</span><span>&lt;nil&gt;</span></div>
106
+ <div class="todo-panel"><span>My first todo</span><span>true</span></div>
107
107
  <div class="count"><span>true</span><span>true</span></div>
108
108
  </li>
109
109
  <li id="todo-2" class="">
110
110
  <div class="view"><span>My second todo</span><span>My second todo</span></div>
111
- <div class="todo-panel"><span>&lt;nil&gt;</span><span>&lt;nil&gt;</span></div>
111
+ <div class="todo-panel"><span>My second todo</span><span>false</span></div>
112
112
  <div class="count"><span>false</span><span>false</span></div>
113
113
  </li>
114
114
  <li id="todo-3" class="">
115
115
  <div class="view"><span>My third todo</span><span>My third todo</span></div>
116
- <div class="todo-panel"><span>&lt;nil&gt;</span><span>&lt;nil&gt;</span></div>
116
+ <div class="todo-panel"><span>My third todo</span><span>false</span></div>
117
117
  <div class="count"><span>false</span><span>false</span></div>
118
118
  </li>
119
119
  </ol>