Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBPIH-5000 Invoice list doesn't store chosen filter params in url #3706

Merged
merged 9 commits into from
Dec 14, 2022

Conversation

kchelstowski
Copy link
Collaborator

No description provided.

createdBy: { name: 'createdBy', accessor: 'id' },
};

if (Object.keys(values).length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Object.keys(values).length is always equal or higher than 0, so you can simplify this condition to: Object.keys(values).length. Numbers higher than 0 are truthy, only 0 is falsy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@alannadolny You are obviously right, I just didn't catch it when copying this part of code, as it was already implemented - funny thing is that in lines 88 and 91 I caught similar issue and remembered to change
from:

if (!statuses || statuses.length === 0)

to:

if (!statuses || !statuses.length)

typeCodes,
fetchTypeCodes,
history,
}) => {
const [defaultValues, setDefaultValues] = useState({});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think [defaultValues. setDefaultValues] can also be included in useInvoiceFilters hook

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure

typeCodes,
fetchTypeCodes,
history,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't really have a problem with passing history as a parameter to this hook but do you think that maybe we could bump up our react-router-dom version to ver 5 where we have useHistory hook available.

If version 5 only adds additional hooks and doesn't change any existing router components or behavior I think we should be fine.
What do you think @awalkowiak ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you think bumping and router-dom should be included in this ticket if we used to use history using withRouter all around the project?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe as soon as you don’t need anything specific (like I needed with redux hooks), we shouldn’t bump up anything additionally. Imo they should be some small tech debt tickets where we could include some „smoke tests” to see if nothing broke

Copy link
Collaborator

Choose a reason for hiding this comment

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

This was just my suggestion to avoid passing history as a parameter and use useHistory() instead. I doubt that there would be much refactoring in the project since version 5 does not remove withRouter HOC, but we probably don't really need it and it is not that big of a problem.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the update is not "problematic", we could make it (to avoid a bigger refactor in the future and replace everywhere the history props to hook). Unless there are some potential issues, then we can skip it for now.

Copy link
Collaborator

@awalkowiak awalkowiak left a comment

Choose a reason for hiding this comment

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

Please bring back sha512 integrity keys

@@ -2776,13 +2776,13 @@
"alphanum-sort": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz",
"integrity": "sha512-0FcBfdcmaumGPQ0qPn7Q5qTgz/ooXgIyp1rf8ik5bGX8mpE2YHjC0P/eyQvxu1GURYQgq9ozf2mteQ5ZD9YiyQ==",
"integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=",
Copy link
Collaborator

Choose a reason for hiding this comment

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

:(

typeCodes,
fetchTypeCodes,
history,
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the update is not "problematic", we could make it (to avoid a bigger refactor in the future and replace everywhere the history props to hook). Unless there are some potential issues, then we can skip it for now.

@awalkowiak awalkowiak merged commit 1f4b85a into develop Dec 14, 2022
@awalkowiak awalkowiak deleted the OBPIH-5000 branch December 14, 2022 14:07
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.

None yet

4 participants