feat: exporta função de clear Form#80
Merged
Merged
Conversation
nerissa-aguirre
commented
Sep 1, 2025
| formState.reset(); | ||
| } | ||
|
|
||
| function clearForm() { |
Author
There was a problem hiding this comment.
repliquei lógica do reset
nerissa-aguirre
commented
Sep 1, 2025
| clearState() { | ||
| setIsDirty(true); | ||
|
|
||
| setFormState(() => { |
Author
There was a problem hiding this comment.
repliquei lógica do update, mas com state vazio
CaioVieira-dev
approved these changes
Sep 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No PR #79 implementei a exportação do resetForm. Essa implementação basicamente disponibilizou a lógica já existente de resetState.
Conscientemente no PR 79, vi que a lógica de resetState resetava o formulário para estado inicial. Vi que não era equivalente a um "update geral" para state vazio. Por mais que eu tivesse consciência desse comportamento, eu não percebi que ele não era exatamente o que eu precisava para https://github.com/geolaborapp/geolabor/pull/9157. Isso porque o estado inicial de um filtro com "persist filter" não é vazio. Ou seja, ao resetar para estado inicial do form do filtro, algum campo viria preenchido (caso o último filtro persistido fosse diferente de vazio).
Nesse PR, estou implementando a lógica do clear form. Ele deve funcionar como um update para state vazio, ou seja, ao clear form, o onChange e transform são disparados.