-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
Refactored theme components and added cypress test. #4843
Conversation
✅ Deploy Preview for volto canceled.
|
Thanks for the PR! I realised that you didn't have permissions on the Plone repo, so I added you in the "Contributors" Team. (/cc @fredvd) This will allow you to work with branches in the Volto repo itself from now on. This is how we normally work, this way it's more handy and agile. I'd like that for every refactored component you open a PR for it. So one PR, one refactored component. This will help us also to keep track of things. I've completed this PR (I've mentioned you there too): #4767 I'd like you to proceed like this one for all the project's PRs.
I'll review now the PR, so you can open a PR for every component in the Volto repo branch with the amendments already. Thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tishasoumya-02 I quickly reviewed the PR, please proceed as the previous comment, and then let's discuss further things when we meet.
It might seem a lot of amendments, but we are in the good path, good work so far!
@@ -4,7 +4,6 @@ about: Plone Improvement Proposal | |||
title: '' | |||
labels: '' | |||
assignees: '' | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As rule of thumb, do not touch (an edit is present) a file that has nothing to do with the PR. The changes should contain only changes relevant to the current matter.
@@ -46,4 +46,3 @@ jobs: | |||
# Required, set by GitHub actions automatically: | |||
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret | |||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, probably you have a formatter that you don't need.
@@ -16,7 +16,7 @@ jobs: | |||
- name: Use Node.js ${{ matrix.node-version }} | |||
uses: actions/setup-node@v3 | |||
with: | |||
# remove workaround for 18.x once https://github.com/nodejs/node/issues/47563 is fixed | |||
# remove workaround for 18.x once https://github.com/nodejs/node/issues/47563 is fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, probably you have a formatter that you don't need that is formatting .yml files.
@@ -48,80 +48,105 @@ const defaultRazzleOptions = { | |||
staticCssInDev: false, | |||
emitOnErrors: false, | |||
disableWebpackbar: false, | |||
browserslist: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie 11', 'not dead'] | |||
browserslist: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the change seems legit, it would go to it's own PR. It seems that this file never was formatted properly, and the CI is not catching it.
@@ -1,4 +1,4 @@ | |||
const { defineConfig } = require('cypress'); | |||
const { defineConfig } = require('cypress') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, take a look at your Prettier extension, it seems something is off there. This one shouldn't be modified if the extension is reading the Prettier project config.
'@id': null, | ||
}, | ||
}; | ||
shallowEqual, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is shallowEqual really necessary here? Since the value is not an object.
}; | ||
const pathname = useMemo(() => { | ||
location.pathname; | ||
}, [location]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESlint is complaining. You are returning nothing.
componentDidMount() { | ||
this.setState({ isClient: true }); | ||
} | ||
}, [loaded, loading]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eslint.
@@ -3,10 +3,10 @@ | |||
* @module components/theme/Header/Header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will merge the PR from #4767
content: PropTypes.shape({ | ||
'@id': PropTypes.string, | ||
const Anontools = () => { | ||
const { token, content } = useSelector( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk about how to make this using the façade, but ideally, we would use one hook for the token, other for the content.
Also, let's discuss if we always return a value or an object. Just to make sure that we are consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohkay ,understood
Sure,I will look into these points and make the changes, closing this PR. |
Refactored Components
Used useSelector,useDispatch,useEffect,useState hooks instead of lifecycle methods and redux functions.
Cypress Test-