Skip to content

fix(examples): use post action in firebase-auth-firestore example#3358

Merged
kentcdodds merged 2 commits intoremix-run:mainfrom
penx:firebase-fix-form-action
Jun 7, 2022
Merged

fix(examples): use post action in firebase-auth-firestore example#3358
kentcdodds merged 2 commits intoremix-run:mainfrom
penx:firebase-fix-form-action

Conversation

@penx
Copy link
Contributor

@penx penx commented Jun 1, 2022

Fix the Firebase example when JavaScript is disabled.

method="delete" is not a valid form action.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-method

While this works when JavaScript is enabled, it does not fall back gracefully.

Instead, use specify form action using name + value on buttons, as shown in FAQs:

https://remix.run/docs/en/v1/pages/faq#how-do-i-handle-multiple-forms-in-one-route

Closes: a bug I encountered while working on the Firebase example - no open issue.

  • Docs N/A
  • Tests

Testing Strategy:

  • is it possible to write integration tests for the examples?

In order to test this manually, I ran the Firebase example with JavaScript enabled and ensured:

  • when submitting new TODO: entries with a blank input, the validation error shows
  • when deleting TODO: entries, the entries are removed

Fix the Firebase example when JavaScript is disabled.

`method="delete"` is not a valid form action.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-method

While this works when JavaScript is enabled, it does not fall back gracefully.

Instead, use specify form action using name + value on buttons, as shown in FAQs:

https://remix.run/docs/en/v1/pages/faq#how-do-i-handle-multiple-forms-in-one-route
@penx penx force-pushed the firebase-fix-form-action branch from 6b79045 to 88207b9 Compare June 1, 2022 20:00
@penx penx requested a review from MichaelDeBoey June 1, 2022 20:01
@penx penx requested a review from MichaelDeBoey June 4, 2022 16:50
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
@MichaelDeBoey MichaelDeBoey changed the title fix(examples/firebase-auth-firestore): delete is not a valid form method fix(examples): use post action in firebase-auth-firestore example Jun 6, 2022
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kentcdodds kentcdodds merged commit 4a0f1a2 into remix-run:main Jun 7, 2022
@penx penx deleted the firebase-fix-form-action branch June 7, 2022 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants