How to handle action matching no intent? - podcast episode cover

How to handle action matching no intent?

Dec 12, 20224 minSeason 3Ep. 16
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

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!

How to handle action matching no intent?

For the best experience, listen in Metacast app for iOS or Android