Skip to content

Releases: maxence-charriere/go-app

v9.2.0

03 Nov 08:03
Compare
Choose a tag to compare

v9.1.2

25 Oct 09:58
Compare
Choose a tag to compare
  • Fixed TFoot typo => fix #621
  • Added the Input capture => fix attribute #625
  • Fixed go doc reference generator

v9.1.1

18 Oct 07:20
Compare
Choose a tag to compare
  • Custom HTML element attributes are now settable with the Attr() function.
  • was loader has been reverted

v9

22 Sep 10:11
Compare
Choose a tag to compare
v9

go-app v9 is here and brings the following changes:

V9 introduces breaking changes. See the v8 to v9 migration guide.

Hope you like this update and thank you for using go-app.

install/update

go get -u github.com/maxence-charriere/go-app/v9/pkg/app

Fix achor downloads

20 Jun 09:52
Compare
Choose a tag to compare

This version fixes achor downloads.

Fix anchor download

20 Jun 09:26
Compare
Choose a tag to compare
Fix anchor download Pre-release
Pre-release

This version fixes anchor downloads.

Custom resource provide + Page Fix

20 Apr 08:12
Compare
Choose a tag to compare
  • Add a custom resource provider that allows prefixing paths #504
  • Browser page is now properly initialized

v8.0.1

30 Mar 07:06
Compare
Choose a tag to compare
  • Documentation related to Routing has been enhanced
  • GenerateStaticWebsite can now generate nested pages

V8: Server side prerendering

25 Mar 12:15
Compare
Choose a tag to compare

Hello there,

Going straight to the point:

  • New version with server-side prerendering in order to have app SEO friendly
  • Documentation has been updated

See the migration guide for the detailed list of changes

Event Handler scope

19 Feb 12:06
Compare
Choose a tag to compare

A scope can be added to event handler in order to trigger event handler updates.

In a scenario where we want to remove a element from a list, a solution is to create an EventHandler which got the element id set outside.
The event handler returned will always have the same addr, which prevent the package to define that an update should be done on the given element.

To solve this, a scope has been added to the methods that set EventHandler.
Here is the an example:

type issue499Data struct {
	ID    int
	Value string
}

type issue499 struct {
	app.Compo

	data []issue499Data
}

func newIssue499Data() *issue499 {
	return &issue499{}
}

func (c *issue499) OnMount(app.Context) {
	c.data = []issue499Data{
		{11, "one"},
		{22, "two"},
		{33, "three"},
		{44, "four"},
		{55, "five"},
		{66, "six"},
		{77, "sever"},
		{88, "eight"},
		{99, "nine"},
	}
	c.Update()
}

func (c *issue499) Render() app.UI {
	return app.Div().Body(
		app.H1().Text("Issue 499"),
		app.Div().
			Body(
				app.Range(c.data).Slice(func(i int) app.UI {
					d := c.data[i]
					return app.Button().
						ID(fmt.Sprintf("elem-%v", d.ID)).
						OnClick(c.newListener(d.ID), d.ID). // HERE the element ID is added in order to trigger the handler update since the func pointer returned by newListener is always the same.
						Text(d.Value)
				}),
			),
	)
}

func (c *issue499) newListener(id int) app.EventHandler {
	return func(app.Context, app.Event) {
		for i, d := range c.data {
			if id == d.ID {
				c.data = append(c.data[:i], c.data[i+1:]...)
				c.Update()
				return
			}
		}
	}
}