Skip to content

Conversation

@Infinoid
Copy link
Contributor

Fix for-loop syntax in html! macro.

@Infinoid
Copy link
Contributor Author

See this yew PR for the changes to for-loop syntax.

I left whitespace alone where possible to keep the changes readable, but there's some extra indentation now. It could be tightened up a bit.

@Infinoid
Copy link
Contributor Author

Infinoid commented Jan 10, 2026

Note: since yew also supports if directly, I think all the extra html! macros and curly braces could be removed, simplifying the whole thing down to:

    html! {
        <tbody class={classes.tbody}>
            if *loading {
                <tr class={classes.loading_row}><td colspan={columns.len().to_string()}>{ texts.loading }</td></tr>
            } else if rows.is_empty() {
                <tr class={classes.empty_row}><td colspan={columns.len().to_string()}>{ texts.empty }</td></tr>
            } else {
                for row in rows.iter() {
                    <tr class={classes.row} role="row">
                        for col in columns.iter() {
                            <td class={classes.body_cell} role="cell">{ row.get(col.id).unwrap_or(&"".to_string()) }</td>
                        }
                    </tr>
                }
            }
        </tbody>
    }

But these simplifications weren't necessary to get it building and passing tests.

@wiseaidev
Copy link
Contributor

Cute thanks!

Fix for-loop syntax in html! macro.

Co-authored-by: wiseaidev <oss@wiseai.dev>
@wiseaidev wiseaidev merged commit 8a3c550 into opensass:main Jan 17, 2026
1 check passed
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.

2 participants