Skip to content

fix: soften html style recommendations from errors on stable to warnings by injecting deprecated functions#4136

Merged
Madoshakalaka merged 2 commits intomasterfrom
soften-deprecation-lints
Apr 18, 2026
Merged

fix: soften html style recommendations from errors on stable to warnings by injecting deprecated functions#4136
Madoshakalaka merged 2 commits intomasterfrom
soften-deprecation-lints

Conversation

@Madoshakalaka
Copy link
Copy Markdown
Member

@Madoshakalaka Madoshakalaka commented Apr 16, 2026

Description

Closes #4129

idea first proposed by @its-the-shrimp

Checklist

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

@Madoshakalaka Madoshakalaka added the A-yew-macro Area: The yew-macro crate label Apr 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

Visit the preview URL for this PR (updated for commit 42c68ec):

https://yew-rs-api--pr4136-soften-deprecation-l-21c589xg.web.app

(expires Sat, 25 Apr 2026 02:42:51 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

Size Comparison

Details
examples master (KB) pull request (KB) diff (KB) diff (%)
actix_ssr_router 613.142 613.061 -0.081 -0.013%
async_clock 100.050 100.051 +0.001 +0.001%
axum_ssr_router 613.141 613.053 -0.088 -0.014%
boids 163.882 163.887 +0.005 +0.003%
communication_child_to_parent 93.483 93.482 -0.001 -0.001%
communication_grandchild_with_grandparent 105.465 105.464 -0.001 -0.001%
communication_grandparent_to_grandchild 101.818 101.819 +0.001 +0.001%
communication_parent_to_child 90.896 90.897 +0.002 +0.002%
contexts 105.708 105.709 +0.001 +0.001%
counter 85.742 85.743 +0.001 +0.001%
counter_functional 87.754 87.756 +0.002 +0.002%
dyn_create_destroy_apps 89.631 89.632 +0.001 +0.001%
file_upload 99.251 99.253 +0.002 +0.002%
function_delayed_input 94.373 94.375 +0.002 +0.002%
function_memory_game 169.552 169.547 -0.005 -0.003%
function_router 399.062 399.080 +0.018 +0.004%
function_todomvc 164.199 164.193 -0.006 -0.004%
futures 234.741 234.742 +0.001 +0.000%
game_of_life 100.489 100.490 +0.001 +0.001%
immutable 258.396 258.393 -0.004 -0.002%
inner_html 80.586 80.587 +0.001 +0.001%
js_callback 109.292 109.294 +0.002 +0.002%
keyed_list 175.909 175.913 +0.004 +0.002%
mount_point 83.953 83.955 +0.002 +0.002%
nested_list 112.853 112.854 +0.001 +0.001%
node_refs 91.469 91.469 0 0.000%
password_strength 1717.808 1717.807 -0.001 -0.000%
portals 93.107 93.110 +0.003 +0.003%
router 365.807 365.814 +0.008 +0.002%
suspense 113.168 113.168 0 0.000%
timer 88.326 88.327 +0.001 +0.001%
timer_functional 98.784 98.787 +0.003 +0.003%
todomvc 141.351 141.352 +0.001 +0.001%
two_apps 85.927 85.928 +0.001 +0.001%
web_worker_fib 136.228 136.227 -0.001 -0.001%
web_worker_prime 184.618 184.618 0 0.000%
webgl 82.729 82.729 0 0.000%

✅ None of the examples has changed their size significantly.

@Madoshakalaka Madoshakalaka changed the title fix: soften deprecated html style errors by injecting deprecated functions fix: soften html style recommendations from errors on stable to warnings by injecting deprecated functions Apr 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

Benchmark - SSR

Yew Master

Details
Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 310.997 312.039 311.226 0.315
Hello World 10 463.475 469.775 467.176 2.429
Function Router 10 30954.791 31522.804 31261.669 187.954
Concurrent Task 10 1005.870 1007.576 1006.963 0.517
Many Providers 10 1025.105 1116.765 1063.326 28.465

Pull Request

Details
Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 311.001 312.199 311.371 0.343
Hello World 10 488.534 490.039 489.216 0.587
Function Router 10 31063.065 31848.627 31471.080 253.935
Concurrent Task 10 1004.939 1007.190 1006.371 0.685
Many Providers 10 1014.839 1075.311 1053.734 17.801

@Madoshakalaka
Copy link
Copy Markdown
Member Author

Madoshakalaka commented Apr 16, 2026

A more nuanced handling is certainly possible: we can keep Diagnostic-based old behavior on nightly only.

It adds to the code complexity but is worth considering imo for cleaner diagnostics output.

Extra complication:

  1. nightly diagnostics is not currently tested
  2. #[allow(deprecated)] will not suppress custom warnings so we need to enable other ways to suppress these warnings. A more invasive and perhaps more granular way is to invent something like HtmlAttribute that expects something like #[yew_style::pre-0.24] inside html!. A less invasive way is to invent a new macro like html_pre_024!{} which turns off style recommendations.

@Madoshakalaka Madoshakalaka marked this pull request as ready for review April 16, 2026 09:17
github-actions[bot]
github-actions Bot previously approved these changes Apr 16, 2026
Comment thread packages/yew-macro/src/html_tree/html_block.rs
@Madoshakalaka Madoshakalaka merged commit 64a348a into master Apr 18, 2026
40 checks passed
shan-shaji pushed a commit to shan-shaji/yew that referenced this pull request Apr 19, 2026
…tack#4136)

now #![allow(deprecated)] can be used to disable these lints

also catch unnecessary html! in if-else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-yew-macro Area: The yew-macro crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not emit hard errors for deprecated html macro patterns

2 participants