From 57511cc7a3d11db69ccdb0fb96dc950937c410ba Mon Sep 17 00:00:00 2001 From: Jacob Mischka Date: Mon, 5 Jun 2023 12:22:55 -0500 Subject: [PATCH] Explicitly create new transactions on ctx.redirect This allows redirecting to the same action to restart it. --- src/examples/basic/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/examples/basic/index.ts b/src/examples/basic/index.ts index d69bc0d..82ec8b5 100644 --- a/src/examples/basic/index.ts +++ b/src/examples/basic/index.ts @@ -2092,9 +2092,14 @@ const interval = new Interval({ { label: 'Make it negative', theme: 'danger', value: 'negative' }, { label: 'Do nothing', value: 'nothing' }, 'Think about it for a while', - '?', + 'Restart', ]) + if (singleChoice === 'Restart') { + await ctx.redirect({ route: 'with_choices' }) + return + } + if (singleReturnValue && singleChoice === 'negative') { singleReturnValue = -singleReturnValue }