Skip to content

Version 0.11.0

Compare
Choose a tag to compare
@github-actions github-actions released this 27 Jul 18:46
· 227 commits to main since this release

Changes in this version:

[0.11.0] - 2024-07-27

New Functions 🚀

  • use_user_media

New Features 🚀

  • Codecs:

    • All codecs now live in their own crate codee
    • There are now binary codecs in addition to string codecs.
      • FromToBytesCodec
      • WebpackSerdeCodec
      • BincodeSerdeCodec
      • ProstCodec (see also the section "Breaking Changes 🛠" below)
    • Every binary codec can be used as a string codec with the Base64 wrapper which encodes the binary data as a
      base64
      string.
      • This required feature base64
      • It can be wrapped for example like this: Base64<WebpackSerdeCodec>.
    • There is now an OptionCodec wrapper that allows to wrap any string codec that encodes T to encode Option<T>.
      • Use it like this: OptionCodec<FromToStringCodec<f64>>.
  • ElementMaybeSignal is now implemented for websys::HtmlElement (thanks to @blorbb).

  • UseStorageOptions now has delay_during_hydration which has to be used when you conditionally show parts of
    the DOM controlled by a value from storage. This leads to hydration errors which can be fixed by setting this new
    option to true.

  • cookie::SameSite is now re-exported

  • Changing the signal returned by use_cookie now tries and changes the headers during SSR.

  • New book chapter about codecs

  • The macro use_derive_signal! is now exported (thanks to @mscofield0).

Breaking Changes 🛠

  • UseStorageOptions and UseEventSourceOptions no longer accept a codec value because this is already provided as a
    generic parameter to the respective function calls.
  • Codecs have been refactored. There are now two traits that codecs implement: Encoder and Decoder. The
    trait StringCodec is gone. The methods are now associated methods and their params now always take references.
    • JsonCodec has been renamed to JsonSerdeCodec.
    • The feature to enable this codec is now called json_serde instead of just serde.
    • ProstCodec now encodes as binary data. If you want to keep using it with string data you can wrap it like
      this: Base64<ProstCodec>.
    • All of these structs, traits and features now live in their own crate called codee
    • A bunch of new codecs are available. Have a look at the docs for crate codee.
  • use_websocket:
    • UseWebsocketOptions has been renamed to UseWebSocketOptions (uppercase S) to be consistent with the return
      type.
    • UseWebSocketOptions::reconnect_limit and UseEventSourceOptions::reconnect_limit is now ReconnectLimit
      instead
      of u64. Use ReconnectLimit::Infinite for infinite retries or ReconnectLimit::Limited(...) for limited
      retries.
    • use_websocket now uses codecs to send typed messages over the network.
      • When calling you have give type parameters for the message type and the
        codec: use_websocket::<String, WebpackSerdeCodec>
      • You can use binary or string codecs.
      • The UseWebSocketReturn::send closure now takes a &T which is encoded using the codec.
      • The UseWebSocketReturn::message signal now returns an Option<T> which is decoded using the codec.
      • UseWebSocketReturn::send_bytes and UseWebSocketReturn::message_bytes are gone.
      • UseWebSocketOptions::on_message and UseWebSocketOptions::on_message_bytes have been renamed
        to on_message_raw and on_message_raw_bytes.
      • The new UseWebSocketOptions::on_message takes a &T.
      • UseWebSocketOptions::on_error now takes a UseWebSocketError instead of a web_sys::Event.
  • use_storage now always saves the default value to storage if the key doesn't exist yet.
  • Renamed BreakpointsSematic to BreakpointsSemantic and breakpoints_sematic to breakpoints_semantic
    (note the n) (thanks to @mondeja).

Fixes 🍕

  • Fixed auto-reconnect in use_websocket
  • Fixed typo in compiler error messages in use_cookie (thanks to @SleeplessOne1917).
  • Fixed potential signal out of scope issue with use_raf_fn

Other Changes 🔥

  • Better links in docs that work both in the book and in rustdoc (thanks to @mondeja).
  • Better CI/CD (thanks to @EstebanBorai).