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

Update to yew 0.20 #69

Merged
merged 5 commits into from
Nov 26, 2022
Merged

Update to yew 0.20 #69

merged 5 commits into from
Nov 26, 2022

Conversation

WorldSEnder
Copy link
Collaborator

@WorldSEnder WorldSEnder commented Mar 23, 2022

This PR tracks the changes necessary to update to the eventual yew 0.20 release.
Upgrades:

  • Use #[hook] on hook integration
  • Use Renderer and features = ["csr"] in the examples

Closes #87
Closes #90

@cryptoquick
Copy link

Heads-up, the code in this PR no longer compiles, it gives this error:

   Compiling stylist v0.10.0 (https://github.com/WorldSEnder/stylist.git?branch=hooks#839dcc83)
error: cannot find attribute `hook` in this scope
  --> /home/hunter/.cargo/git/checkouts/stylist-45475ec210f96b03/839dcc8/packages/stylist/src/yew/hooks/use_media_query.rs:12:3
   |
12 | #[hook]
   |   ^^^^

error: cannot find attribute `hook` in this scope
  --> /home/hunter/.cargo/git/checkouts/stylist-45475ec210f96b03/839dcc8/packages/stylist/src/yew/hooks/use_style.rs:25:3
   |
25 | #[hook]
   |   ^^^^

error: could not compile `stylist` due to 2 previous errors

Using yew master on rev 5355b65ff5f9747cbad801d4b337a5ac7a94d0f4.

Copy link
Owner

@futursolo futursolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM.

I will line up a release tomorrow for 0.11.

Thanks.

//! ## Features Flags
//!
//! - `macros`: Enabled by default, this flag enables procedural macro support.
//! - `random`: Enabled by default, this flag uses `fastrand` crate to generate a random class name.
//! Disabling this flag will opt for a class name that is counter-based.
//! - `parser`: Disabled by default, this flag enables runtime parsing of styles from strings. You
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parser is actually enabled by default.

I am indifferent in disabling or enabling this by default.
I felt disabling this might be better but we do lose debug assertions on interpolation values. We can make the parser by default debug only, but there doesn't seem to be a way to exclude dependencies on release anyways so the benefit seems not big enough.

Copy link
Collaborator Author

@WorldSEnder WorldSEnder Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm you are right. Can we maybe internally consume stylist-core/parser (trusting the tree shaking and dead code elimination in release mode) but still only publicly expose the additional features with stylist/parser turned on?

The point being that the default might trick users into using the runtime parsing via the IntoPropValue impls, which causes unnecessary overhead.

EDIT: I see, power users wouldn't be able to get rid of the nom dependency.

Copy link
Collaborator Author

@WorldSEnder WorldSEnder Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split the feature into parser for the public part and debug_parser for the debug assertions. Note that there were a few examples that mistakenly used the parser/runtime parsed styles in their <Global /> styles, and disabling this shaves some kB from the wasm binary ;)

@futursolo futursolo merged commit ad10fd0 into futursolo:master Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: get component identifier from function name if PascalCase Using css macro in yew component
3 participants