···2233a web component that shows the replies to a linked bsky post as comments.
4455+
66+57[](https://hex.pm/packages/bsky_comments_widget)
68[](https://hexdocs.pm/bsky_comments_widget/)
79
+1-1
gleam.toml
···11name = "bsky_comments_widget"
22-version = "1.0.2"
22+version = "1.0.3"
33target = "javascript"
4455# Fill out these fields if you intend to generate HTML documentation or publish
···7979 use did <- decode.field("did", decode.string)
8080 use handle <- decode.field("handle", decode.string)
8181 use display_name <- decode.field("displayName", decode.string)
8282- use avatar_url <- decode.field("avatar", decode.string)
8282+ use avatar_url <- decode.optional_field("avatar", "", decode.string)
8383 decode.success(Author(did:, handle:, display_name:, avatar_url:))
8484}
8585···9595 "app.bsky.embed.external#view" -> {
9696 use ext <- decode.field("external", {
9797 use description <- decode.field("description", decode.string)
9898- use thumb <- decode.field("thumb", decode.string)
9898+ use thumb <- decode.optional_field("thumb", "", decode.string)
9999 use title <- decode.field("title", decode.string)
100100 use uri <- decode.field("uri", decode.string)
101101 decode.success(#(description, thumb, title, uri))
+1
src/bsky_comments_widget/widget.gleam
···5353}
54545555fn update(_model: Model, msg: Msg) -> #(Model, Effect(Msg)) {
5656+ // i usually put an echo here when i want to debug the fetch/decode logic
5657 case msg {
5758 ApiReturnedPost(Ok(post)) -> #(Comments(main_post: post), effect.none())
5859 ApiReturnedPost(Error(_)) -> #(CouldntLoad, effect.none())