Release post: https://sycamore-rs.netlify.app/news/announcing-v0.6.0
-
⚡️ Features
- Add integrations for
sycamore-router
. - Added
dangerously_set_inner_html
special attribute to html elements. This allows directly setting an element's inner html without going through aNodeRef
and manually calling.set_inner_html()
. - Implement
Portal
s. Portals allow adding nodes to elements that are in another tree. - Allow instantiating components with the
Component
trait. You can now also create components that are generic over another component. This pattern can be seen in thehigher-order-components
example. - Respect base html tag in router.
- Dark mode on website!
create_reducer
hook. Thecreate_reducer
hook is an alternative toSignal::new
. It allows you to use a reducer function to get the next state from the previous state.enum Msg { Increment, Decrement, } let (state, dispatch) = create_reducer(0, |state, msg: Msg| match msg { Msg::Increment => *state + 1, Msg::Decrement => *state - 1, });
- Opt out of router by using
rel="external"
on an anchor tag. Addingrel="external"
to an anchor tag will use the browser's default navigation behavior.template! { a(href="path", rel="external") { "Link" } }
- Add integrations for
-
🛠 Fixes
- Fix logic error in
reconcile_fragments
. - Fix grammar on website index page.
- Scroll to top when navigating to a page.
- Use
ahash
instead of default SipHash for better performance. - Explicitly define MSRV to 1.53 and run CI in a matrix.
- Remove inline JS snippet. This removes the need to load an extra JS file before Sycamore can start.
- Add some UI tests for
#[component]
attribute macro. - Generate a
sitemap.xml
for the website. - Fix broken link to the reactivity page on the website index page.
- Explain that Trunk needs a
index.html
file in Hello World docs. - Remove internal
Rc
fromDomNode
. This significantly improves performance and memory usage. See the PR for benchmarks. - Optimize the website with
wasm-opt
to reduce binary size. - Optimize
create_effect
. - Fix
SsrNode
's implementation ofremove_child
removing two children instead of just one. - Hold a backlink for each
ReactiveScope
to its parent scope. This fixes a bug whereuse_context
could only access the context on the first render and would panic on subsequent accesses. - Remove dependency on
chrono
. This was replaced with direct access to browser APIs to reduce the number of dependencies and thus to improve build times. - Replace internal usage of
.unwrap()
with.unwrap_throw()
. Slightly improves binary sizes. - Derive
Clone
forsycamore_router
path types. - Update
todomvc
example with latest features. - Fix router not actually parsing identifiers. Fixes a bug where a dynamic parameter followed by a dynamic segment would parse as a single segment.
- Build rustdocs in CI. The API documentation for the
master
branch is available at sycamore-rs.netlify.app/api. - Reorganize documentation a bit.
- Fix logic error in
-
🚨 BREAKING CHANGES
- Extract reactive primitives into separate crate
sycamore-reactive
. Reactive primitives are now re-exported in thesycamore
crate to avoid adding new dependencies to your project. It is also now possible to use reactive primitives without usingsycamore
by directly depending onsycamore-reactive
. - Rename sub-module
sycamore::rx
tosycamore::reactive
.rx
might be ambiguous with Rx family of libraries. Renaming toreactive
makes it clear that it works differently from Rx libraries. - Refactored router with new API. See the new documentation for more details.
- Support boolean attributes. Some attributes now expect a
bool
instead ofimpl ToString
. This also fixes an issue where previously, attributes couldn't be removed directly from thetemplate!
macro.// Before template! { input(type="checkbox", checked="") { "Checkbox" } } // After template! { input(type="checkbox", checked=true) { "Checkbox" } }
- Extract reactive primitives into separate crate