
How to handle action matching no intent?
Jan asked this on 2022-12-01
Audio is streamed directly from the publisher (media.transistor.fm) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.
Show Notes
Hi Kent its Jan,
What do you do in your action function in Remix for a page with multiple forms, if no intent matches?
Let's say you have a page with two forms, one for deleting an entity and one for duplicating it. So the page has two forms each with a button of type submit, one with an intent of delete and one of with an intent of duplicate.
Now what do you do if the request to that action function contains form data with neither intent?
In Ryan's Remix single, where he shows how to handle multiple forms, his action is a void promise and returns nothing in the case where none of his intents match.
But should you do that in a production app? Just don't do anything?
Thanks for your help! And thank you for answering yesterdays question about testing tables, it helped me out tremendously.
Take care!