Skip to content

v0.0.9

Choose a tag to compare

@jackielii jackielii released this 26 Aug 17:48
· 190 commits to main since this release

What's New in v0.0.9

✨ Features

  • Dynamic Component Selection: Added RenderComponent() function that allows Props methods to dynamically select which component to render
  • Improved Props Resolution: Props method resolution now correctly uses PageConfig for component selection
  • Skip Rendering Support: Added proper support for ErrSkipPageRender in Props methods for conditional rendering

🐛 Bug Fixes

  • Fixed props method resolution to correctly interact with PageConfig
  • Resolved deprecation warnings in the codebase

🧪 Testing Improvements

  • Added comprehensive tests for ErrSkipPageRender functionality
  • Removed templ dependency from test files for cleaner testing

📝 Example Usage

The new RenderComponent function allows dynamic component selection:

func (p MyPage) Props(r *http.Request) (string, error) {
    if r.URL.Query().Get("partial") == "true" {
        // Render PartialView component with custom data
        return "", RenderComponent("PartialView", "custom data")
    }
    return "default data", nil
}

This release improves the flexibility of the structpages framework while maintaining backward compatibility.