Skip to content

Conversation

Johnviti
Copy link
Contributor

No description provided.

@HbLuca HbLuca linked an issue May 25, 2024 that may be closed by this pull request
Comment on lines 84 to 85
const storedFilterData = loadFilterData();
const Keys = ['search', 'priority', 'cities'];
Copy link
Member

Choose a reason for hiding this comment

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

Como essa variável keys não sofre alterações, ela pode ser definida fora do render, não sendo recriada a todo momento.

Tenho a impressão que essa storedFilterData (que não é apenas dados armazenados) pode ser criada no início do componente e seu valor passado para o useState e reutilizada depois aqui.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vou realizar esses ajuste, válido demais seu comentário


useEffect(() => {
saveFilterData(filterData);
}, [filterData]);

Choose a reason for hiding this comment

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

um pouco confuso storedFilterData e filterData referenciando a mesma coisa. eu removeria storedFilterData, passaria o loadFilterData() como argumento de useState em L37 e juntaria os 2 useEffect's

@Kiro-tagama
Copy link

Kiro-tagama commented May 27, 2024

não seria mais pratico usar o context do que salvar no local ou vc criou algo para apagar depois?

@Johnviti
Copy link
Contributor Author

Johnviti commented May 27, 2024

não seria mais prático usar o contexto do que salvar no local ou vc criou algo para apagar depois?

Adicione na função clearSearch para realizar a remoção

@Johnviti
Copy link
Contributor Author

Eu vou subir as alterações com base em todos os comentários, vlww

@Johnviti
Copy link
Contributor Author

Ajustado!!

@avpalmeira @lucianomlima

@larissapissurno
Copy link
Contributor

@Johnviti pode resolver o conflito, pf?

@Johnviti
Copy link
Contributor Author

Johnviti commented Jun 2, 2024

@Johnviti pode resolver o conflito, pf?

Feito

Copy link
Contributor

@larissapissurno larissapissurno left a comment

Choose a reason for hiding this comment

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

primeiramente parabéns pelo trabalho @Johnviti

adicionei um minor e rodando localmente encontrei erros ao rodar:

npm run build:

image

npm run lint:

image

poderia dar uma olhada neles?

};

const loadFilterData = (): IFilterFormProps => {
const storedFilterData = JSON.parse(localStorage.getItem('filterData') || '{}');
Copy link
Contributor

Choose a reason for hiding this comment

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

poderia mudar filterData pra kebab-case pra seguir o padrão local storage key names do projeto?

Copy link
Contributor Author

@Johnviti Johnviti Jun 2, 2024

Choose a reason for hiding this comment

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

Vou ajustar e verificar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feito

Copy link
Contributor

@larissapissurno larissapissurno left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@larissapissurno
Copy link
Contributor

Testado localmente e a funcionalidade atende os requisitos. O código atende e está apto a ser mergeado.

@larissapissurno larissapissurno merged commit b58d437 into SOS-RS:develop Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Filtros não persistem ao retornar de um abrigo específico.

5 participants