VikWeb.Decorators (Vik v0.0.1-rc2)
View SourceThis black-magic fuckery allows you to just return the socket
from LiveView callbacks rather than wrapping it in a tuple like
{:noreply, socket} or {:ok, socket}.
Usage
Put the following at the top of your LiveView to activate this on all functions:
use VikWeb.Decorators
@decorate_all wrap_noreply()If using inside VikWeb, this module is automatically activated, and
only the second line is required.
Circumvention
If you still wanna return tuples that is fine, and should keep working
while using this decorator, because for some LiveView behaviour
(eg. Phoenix.LiveView.handle_info/2) returning {:reply, socket, details}
tuples is still desired.