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

feat: support arrays for Classes/classes!() #3393

Merged
merged 2 commits into from
Sep 23, 2023
Merged

feat: support arrays for Classes/classes!() #3393

merged 2 commits into from
Sep 23, 2023

Conversation

pouriya
Copy link
Contributor

@pouriya pouriya commented Sep 5, 2023

support [Into<Classes>;SIZE] directly

instead of using .as_ref():

use yew::{classes, html};

let classes = ["class-1", "class-2"];

html! {
  <div class={classes!(classes.as_ref())}></div>
};

now we can do this:

use yew::{classes, html};

html! {
  <div class={classes!(["class-1", "class-2"])}></div>
};

Checklist

  • I have reviewed my own code
  • I have added tests

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Visit the preview URL for this PR (updated for commit 8f7d238):

https://yew-rs--pr3393-support-arrays-in-cl-7gnj1iul.web.app

(expires Tue, 12 Sep 2023 09:09:31 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Size Comparison

examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 102.553 102.553 0 0.000%
boids 175.839 175.839 0 0.000%
communication_child_to_parent 95.528 95.528 0 0.000%
communication_grandchild_with_grandparent 109.276 109.276 0 0.000%
communication_grandparent_to_grandchild 105.943 105.943 0 0.000%
communication_parent_to_child 93.015 93.015 0 0.000%
contexts 111.246 111.246 0 0.000%
counter 89.424 89.424 0 0.000%
counter_functional 90.161 90.161 0 0.000%
dyn_create_destroy_apps 92.599 92.599 0 0.000%
file_upload 103.755 103.755 0 0.000%
function_memory_game 174.813 174.813 0 0.000%
function_router 352.635 352.635 0 0.000%
function_todomvc 163.743 163.743 0 0.000%
futures 227.987 227.987 0 0.000%
game_of_life 112.538 112.538 0 0.000%
immutable 189.453 189.453 0 0.000%
inner_html 86.210 86.210 0 0.000%
js_callback 113.474 113.474 0 0.000%
keyed_list 201.532 201.532 0 0.000%
mount_point 89.412 89.412 0 0.000%
nested_list 114.839 114.839 0 0.000%
node_refs 96.518 96.518 0 0.000%
password_strength 1584.306 1584.306 0 0.000%
portals 98.595 98.595 0 0.000%
router 318.773 318.773 0 0.000%
simple_ssr 144.353 144.353 0 0.000%
ssr_router 390.387 390.387 0 0.000%
suspense 119.111 119.111 0 0.000%
timer 91.974 91.974 0 0.000%
timer_functional 100.682 100.682 0 0.000%
todomvc 143.905 143.905 0 0.000%
two_apps 90.124 90.124 0 0.000%
web_worker_fib 154.711 154.711 0 0.000%
webgl 88.729 88.729 0 0.000%

✅ None of the examples has changed their size significantly.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Benchmark - SSR

Yew Master

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 424.089 430.845 427.813 1.671
Hello World 10 774.756 785.497 781.234 3.013
Function Router 10 2508.327 2530.200 2520.488 6.712
Concurrent Task 10 1007.969 1010.759 1009.458 1.039
Many Providers 10 1723.912 1760.124 1738.000 9.841

Pull Request

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 424.887 428.643 427.932 1.141
Hello World 10 779.179 785.020 781.509 2.140
Function Router 10 2510.827 2571.026 2523.753 17.487
Concurrent Task 10 1007.466 1013.242 1009.708 1.569
Many Providers 10 1728.820 1769.728 1748.934 12.877

Copy link
Member

@ranile ranile left a comment

Choose a reason for hiding this comment

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

Thanks!

@ranile ranile added the A-yew Area: The main yew crate label Sep 6, 2023
@futursolo futursolo merged commit 2cbe6ce into yewstack:master Sep 23, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew Area: The main yew crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants