Skip to content

Commit

Permalink
feat(libserver): checking for and fixing data map in PageCreate and P…
Browse files Browse the repository at this point in the history
…ageHeadlessCreate.
  • Loading branch information
razshare committed Feb 20, 2025
1 parent e247e2c commit a561a04
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,11 @@ func PageWithData(self *Page, key string, value any) {
var noScriptPattern = regexp.MustCompile(`<script.*>.*</script>`)
var pagesToPaths = map[string]string{}

// PageAsPath maps a page as a path.
func PageAsPath(self *Page, path string) {
pagesToPaths[self.pageId] = path
}

// PageCompile compiles a svelte page.
func PageCompile(self *Page) (string, error) {
if nil == self {
Expand Down Expand Up @@ -1299,6 +1304,11 @@ func PageHeadlessCreate(
if nil == data {
data = map[string]any{}
}

data["form"] = map[string]any{}
data["query"] = map[string]any{}
data["path"] = map[string]any{}

return &Page{
renderMode: RenderModeServer,
data: data,
Expand Down

0 comments on commit a561a04

Please sign in to comment.