Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML + Binding #278

Closed
vi4m opened this issue Sep 22, 2020 · 4 comments · Fixed by #279
Closed

HTML + Binding #278

vi4m opened this issue Sep 22, 2020 · 4 comments · Fixed by #279
Assignees
Labels
bug Something isn't working

Comments

@vi4m
Copy link

vi4m commented Sep 22, 2020

I've tried to build HTML which will react to external events from external components(such as Button click), through "Binding" wrapper.

struct SVGCircle View 7

It does render with intial value, but it doesn't re-render after sending new value.

Questions:

  • How to properly handle this?
  • It this a bug?
  • Should I use DynamicHTML instead?
@MaxDesiatov MaxDesiatov added the bug Something isn't working label Sep 22, 2020
@MaxDesiatov MaxDesiatov self-assigned this Sep 22, 2020
@MaxDesiatov
Copy link
Collaborator

Hi @vi4m, thanks for reporting this, it looks like a bug to me. I'm investigating it now.

MaxDesiatov added a commit that referenced this issue Sep 23, 2020
Property assignment does not update SVG elements. We may want to use properties instead of `setAttribute` in the future for optimizations. For now I think that `setAttribute` works in all cases, including SVG, and seems safer to me.

Resolves #278.

* Use setAttribute, not properties to fix SVG update

* Add HTMLAttribute to cleanly apply DOM updates

* Add doc comment to HTMLAttribute

* Update Sources/TokamakStaticHTML/Views/HTML.swift

Co-authored-by: Jed Fox <git@jedfox.com>

* Use static func property in TokamakDOM/TextField.swift

* Make `static func property` public

* Declare `static let value` on `HTMLAttribute`

Co-authored-by: Jed Fox <git@jedfox.com>
@MaxDesiatov
Copy link
Collaborator

This is fixed in the main branch now and will be included in the next release of Tokamak. Thanks again for catching the issue!

@vi4m
Copy link
Author

vi4m commented Sep 24, 2020

Thanks for a quick fix! Working as expected now 👍

@MaxDesiatov
Copy link
Collaborator

MaxDesiatov commented Sep 24, 2020

That's great! Feel free to reopen or to create a new issue if you have any problems/questions 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants