Thanks to visit codestin.com
Credit goes to github.com

Skip to content

form shouldDisplay logic causes crash due to stale captured variables -- updated demo to reveal #1390

@rcoreilly

Description

@rcoreilly

Describe the bug

form contains code like this inside field closures:

					w.Styler(func(s *styles.Style) {
						f := fm.structFields[i]

but the value of i depends on what was actually shown previously, so it can crash with out-of-range errors here. this happens in axon, and I updated the order of fields in demo to show it.

we need a canonical path name, not an index, and to find the field data by that path name.

How to reproduce

open demo, click things in the first inline guy.

Example code

No response

Relevant output

No response

Platform

macOS

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctlyconfirmedThis bug has been confirmed

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions