Yew: Optional attributes in 0.17.4 is not working

Created on 25 Oct 2020  路  5Comments  路  Source: yewstack/yew

Problem

Today I tried to change the version of yew in yewprint to 0.17.4 which includes optional attributes but it failed.

To be sure that it's a bug I tried to copy the "counter" example from yew and I added an optional attribute. This is the repository: https://github.com/cecton/test-yew-optional-attributes

error: this prop doesn't have a value
  --> src/main.rs:46:35
   |
46 |                 <nav class="menu" style?=None>
   |                                   ^^^^^
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

I added a GitHub Action so you can see the error message.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Use yew 0.17.4 in dependency of an external project
  2. Make code that uses an optional attribute. For example: <div style?=None />
  3. Compile

Expected behavior

Compilation should work.

Screenshots

See the result of the GitHub Action in this proof repository: https://github.com/cecton/test-yew-optional-attributes/runs/1304358948?check_suite_focus=true#step:3:223

Environment:

  • Yew version: 0.17.4
  • Rust version: stable
  • Target, if relevant: x86_64 and wasm

Questionnaire

  • [ ] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

Since the optional attributes are not in the changelog of 0.17.4 and I guess you are already moving towards 0.18.0, it might be easier to yank the version, drop the feature and release a 0.17.5 without it. But you will need to create a 0.17 branch.

bug

Most helpful comment

Tags are fixed, sorry @cecton!

All 5 comments

Optional attributes are set for version 0.18, they're not released yet.
It's a bit confusing because the GitHub release is tagged on the "master" branch but I'm confident @jstarry published the crate based on the https://github.com/yewstack/yew/tree/v0.17 branch.

Hmmm that explains a lot. Maybe the tag is wrong then? 0.17.4

Yes, I think the tag is wrong https://github.com/yewstack/yew/commits/0.17.4?after=724ac1d4813b8e74b94602c0875d6f18ff81ad3e+34&branch=0.17.4

Ah yeah that's what you just said sorry 馃槳 sleeping issues

Ok so maybe this tag should be corrected.

Ah yeah, good point. I'll fix the tag

Tags are fixed, sorry @cecton!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nixpulvis picture nixpulvis  路  4Comments

jstarry picture jstarry  路  4Comments

DenisKolodin picture DenisKolodin  路  5Comments

kellytk picture kellytk  路  3Comments

sanpii picture sanpii  路  3Comments