-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: "N available" copy to the dispatcher side. #383
base: main
Are you sure you want to change the base?
Conversation
@broadcasted_infos [ | ||
:task_created, | ||
:task_deleted, | ||
:task_updated, | ||
:campaign_rider_created, | ||
:campaign_rider_deleted | ||
] | ||
|
||
@impl Phoenix.LiveView | ||
def handle_info({event, entity}, socket) when event in @broadcasted_infos do | ||
if entity_in_campaigns?(socket.assigns.campaigns, entity.campaign_id) do | ||
{:noreply, refetch_and_assign_data(socket)} | ||
else | ||
{:noreply, socket} | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
two feedbacks:
- I think this should go after the handle_events
- It needs a
@impl Phoenix.LiveView
@doc "silently ignore other kinds of messages"
def handle_info(_, socket), do: {:noreply, socket}
after it to silently ignore messages we don't care about (or else the LV crashes :()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except small bit of feedback!
Ready for re-review @mveytsman ! |
Describe your changes
Up for discussion: adding clarification copy about remaining slots to sign up for on the dispatcher side. Originally suggested up by @chadmohr in this slack thread.
Screenshot
CleanShot.2024-06-06.at.19.10.31.mp4
Checklist before requesting a review
about this update in the description above.