Skip to content

Commit

Permalink
fix sui dynamic components import bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Sep 30, 2024
1 parent dc162bb commit 369d6cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sui/core/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ func (page *Page) parseDynamics(ctx *BuildContext, sel *goquery.Selection) {
return
}
ctx.addJitComponent(route)

// This is a temprary solution, we will refactor this later
// Some components are not used in the page, but they are used in the script
// So we need to add them to the components
// But this solution is not perfect, it will cause import the unnecessary components, just ignore it.
// Add to the imports
name := fmt.Sprintf("comp_%s", strings.ReplaceAll(route, "/", "_"))
ctx.components[name] = route
})
}

Expand Down
1 change: 1 addition & 0 deletions sui/core/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ func (parser *TemplateParser) show(sel *goquery.Selection) {
// sel.SetAttr("style", style)
}

// Tidy the template by removing the parsed attributes
func (parser *TemplateParser) Tidy(s *goquery.Selection) {

s.Contents().Each(func(i int, child *goquery.Selection) {
Expand Down

0 comments on commit 369d6cc

Please sign in to comment.