#my lustre message isnt working

1 messages · Page 1 of 1 (latest)

naive flint
#

context: #general message (scroll down from here)
#general message

my decoders are definitely not failing and i can literally print the PlaylistPlayRequest in the on_playlist function callback but the message never happens

midnight hill
#

ok I will believe you for a second
unfortunately I can't figure out how to run your app so here's what you can do:

add a console.log inside build/dev/javascript/lustre/lustre/runtime/client/runtime.ffi.mjs on line 87:

const dispatch = (event, data) => {
  const [events, result] = Events.dispatch(this.#events, data);
  this.#events = events;
+ console.log(result);
  if (result.isOk()) {

then restart dev-tools. what does it print for that event?

naive flint
#

oh it was missing a field

#

thats misleading

midnight hill
#

what's misleading ^.^

naive flint
#

because it it cant decode why is it still giving me a result that looks correct

midnight hill
#

it fills the values out with zero values

#

that's what we meant when we said the decoder always runs fully

#

there is no early out and you will get a result even though there were errors along the way

naive flint
#

and it makes for terrific debugging (terrible)

midnight hill
#

yes I agree

#

but these are the semantics that are wanted for the decode api

naive flint
#

😪

#

well yay

#

i can play playlists now

midnight hill
#

there's this thing that hayleigh came up with where you call decode.run yourself so you can look at the error:

event.on("whatever", {
  let decoder = {
    use wibble <- decode.field("...", ...)
    ...
  }

  use event <- decode.then(decode.dynamic)
  let assert Ok(result) = decode.run(event, decoder)
  
  decode.success(SomethingHappened(result))
})
naive flint