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

Prevent binding from panicking when not in wasm #278

Merged
merged 2 commits into from
Oct 15, 2021
Merged

Prevent binding from panicking when not in wasm #278

merged 2 commits into from
Oct 15, 2021

Conversation

zyllian
Copy link

@zyllian zyllian commented Oct 14, 2021

This fixes an issue I ran across while using the same template code to do SSR and DOM rendering where using value:bind would panic during SSR because it tries to call an unimplemented function from wasm_bindgen.

This isn't a particularly elegant solution to the problem, so I'm sure it can be improved.

@lukechu10 lukechu10 added A-SSR Area: Server Side Rendering (SSR) and Static Site Generation (SSG) C-bug Category: bug, something isn't working labels Oct 14, 2021
@lukechu10
Copy link
Collaborator

LGTM. Thanks for the contribution!

@lukechu10 lukechu10 enabled auto-merge (squash) October 14, 2021 22:17
@arctic-hen7
Copy link
Contributor

Indeed, this will make using data binding possible in Perseus!

@lukechu10
Copy link
Collaborator

Ah, the tests are failing because the #[cfg]s are in the wrong place. These are evaluated during compile time so the target is the target on which the code is being built. The #[cfg]s should belong inside the quote! macro instead.

@zyllian
Copy link
Author

zyllian commented Oct 15, 2021

Okay, that should fix it and also make the cfg attribute less restrictive.

@lukechu10 lukechu10 merged commit 21509aa into sycamore-rs:master Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-SSR Area: Server Side Rendering (SSR) and Static Site Generation (SSG) C-bug Category: bug, something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants