core icon indicating copy to clipboard operation
core copied to clipboard

webxdc update events

Open Septias opened this issue 3 years ago • 11 comments

closes #3320

Septias avatar Sep 12 '22 07:09 Septias

I don't really like the event approach, how about adding it as a property of webxdc info and reusing the message changed event, or just adding one new event indicating the value was updated?

Simon-Laux avatar Sep 12 '22 17:09 Simon-Laux

why don't you like it though?

Septias avatar Sep 12 '22 17:09 Septias

why don't you like it though?

there can be many events with this approach, also I'm not quite sure of the usecase, if its only for an icon then a getter + an update event with the messageid would be better and easier to deal with. (less to implement, and with the event triggers getter pattern there is neither outdated data, nor no data if the message was loaded/displayed between the events. an thus doesn't have any state until the next event comes in)

Simon-Laux avatar Sep 12 '22 19:09 Simon-Laux

Should I still create one more event like WebxdcLoadingStateChanged or should I reuse MsgChanged? @r10s @Simon-Laux

Septias avatar Sep 14 '22 13:09 Septias

for dc_get_updating_webxdc() - what is the usecase for the ui wanting an array of all webxdc that need updates?

intuitively, i'd say sth. that returns the update state for a given message is much more handy and probably what is needed by UI - of course, UI can search the array, but in general our ffi is always driven by direct UI needs :)

but maybe i also have overseen a usecase :)

we can also do an av about that tomorrow.

r10s avatar Sep 14 '22 17:09 r10s

Yeah I also thought about that but I decided that since sorting has to be done either way (frontend or backend) it can also be done in the frontend leaving a more flexible ffi interface. But if our design guideline is focused on alignment with frontend needs I can obviously change the functions signature

Septias avatar Sep 15 '22 05:09 Septias

@r10s does your thumbs up mean that you understand my reasoning or do you want me to change it?

Septias avatar Sep 15 '22 12:09 Septias

both - i understand the reasoning but would still prefer a more UI-friendly function signature :)

r10s avatar Sep 15 '22 14:09 r10s

What is better for the UI? A new event which notifies that update-state has changed or reuse of the MsgChanged Event? @Simon-Laux @r10s @Hocuri

Septias avatar Sep 18 '22 09:09 Septias

I'd vote for new event, though I also can see points for reusing the msgs_changed event, but then callbacks that are not needed might be called too, so I think a dedicated event is better.

Simon-Laux avatar Sep 18 '22 10:09 Simon-Laux

I'd vote for new event, though I also can see points for reusing the msgs_changed event, but then callbacks that are not needed might be called too, so I think a dedicated event is better.

yeah same

Septias avatar Sep 18 '22 10:09 Septias

can I merge this? @r10s

Septias avatar Sep 29 '22 20:09 Septias

thanks a lot, for pushing that forward!

for general reasons, i'd wait until 1.34 is released. ui won't adapt to this pr sooner anyway - and this avoids unforeseeable side effects (for such reasons i am not a fan of automerge, btw)

EDIT: some quick comments: changelog entry is outdated. is is_sending and is_sent seem to be the same, so only use one wording, if "is updating" is also the same, maybe just go for that.
also wondering if there is any real benefit in having "is updating" as event-parameter (i am just wondering, i do not suggest to change that part right now :)

r10s avatar Sep 30 '22 08:09 r10s

As I recall holger wanted to reduce open prs, so is this mergebal now @r10s. You wanted to wait for 1.34, is it out?

Septias avatar Dec 04 '22 13:12 Septias

rebased and ready to merge @r10s

Septias avatar Dec 13 '22 10:12 Septias

rebased and ready to merge @r10s

Septias avatar Jan 16 '23 17:01 Septias

I thought it would be nice to have an event that notifies the ui when the webxdc update state changes because otherwise you would have to bussily check for when all updates are sent out. You could do that every second or so which would not produce such a high load but it seems more accurate with an event. @r10s

Edit: Sorry, I misred your comment. You just want to remove the is_sending flag and not the whole event. We can of course do that but having this information in the event can spare us some sql-queries in some scenarios which is why I added it in the first place. If we don't care about that the second approach might be a bit cleaner.

Septias avatar Jan 23 '23 10:01 Septias

@r10s, I would like to finnally finish this PR. Are you also willing to push this forward? Because then I would do a rebase and look over it again

Septias avatar Mar 20 '23 10:03 Septias

i think, this pr is sth. for 1.38, where we probably target webxdc again

r10s avatar Mar 20 '23 12:03 r10s

closing this as stalling

Septias avatar Jan 02 '24 16:01 Septias