Skip to content

Instantly share code, notes, and snippets.

@marcusramberg
Created September 24, 2018 14:00
Show Gist options
  • Save marcusramberg/74b10d9f98260758ddf606783a5c0ddc to your computer and use it in GitHub Desktop.
Save marcusramberg/74b10d9f98260758ddf606783a5c0ddc to your computer and use it in GitHub Desktop.
diff --git a/Changes b/Changes
index 50519bb..279787a 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
Revision history for perl distribution Mojolicious-Plugin-PromiseActions
+0.06 Not Released
+
+- Ensure we actually hold on to the tx
+- Return all arguments passed from the action.
+
0.05 2018-05-23T10:47:41+0200
- Update required Mojolicious version
diff --git a/lib/Mojolicious/Plugin/PromiseActions.pm b/lib/Mojolicious/Plugin/PromiseActions.pm
index c5aa154..734295e 100644
--- a/lib/Mojolicious/Plugin/PromiseActions.pm
+++ b/lib/Mojolicious/Plugin/PromiseActions.pm
@@ -11,12 +11,12 @@ sub register {
$app->hook(
around_action => sub {
my ($next, $c) = @_;
- my $res = $next->();
+ my ($res, @rest) = $next->();
if (blessed($res) && $res->can('then')) {
- my $tx = $c->render_later;
+ my $tx = $c->render_later->tx;
$res->then(undef, sub { $c->reply->exception(pop) and undef $tx });
}
- return $res;
+ return $res, @rest;
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment