-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Pagination: Received NaN for the 'value' attribute #4035
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
@gcalica good catch, thanks for reporting 👍 It happens because
export default class Pagination extends Component {
+ getInitialAutoControlledState() {
+ return { activePage: 1 }
+ }
common.isConformant(Pagination, {
requiredProps: {
totalPages: 0,
},
})
common.hasSubcomponents(Pagination, [PaginationItem])
+ describe('activePage', () => {
+ it('defaults to "1"', () => {
+ const wrapper = mount(<Pagination totalPages={3} />)
+
+ wrapper.find('PaginationItem').at(0).should.have.prop('active')
+ })
+
+ it('can be set via "defaultActivePage"', () => {
+ const wrapper = mount(<Pagination defaultActivePage={2} totalPages={3} />)
+
+ wrapper.find('PaginationItem').at(3).should.have.prop('active')
+ })
+
+ it('can be set via "activePage"', () => {
+ const wrapper = mount(<Pagination activePage={2} totalPages={3} />)
+
+ wrapper.find('PaginationItem').at(3).should.have.prop('active')
+ })
+ })
+ Would you like to a submit a PR? 😸 |
@layershifter Submitted a PR. |
A fix was released in |
Bug Report
When you you don't specify an
activePage
or adefaultActivePage
; then on the first render of the Pagination, two of the Pagination Items (Previous Item and Next Item) have "NaN" as their valuesSteps
A clear and concise description of steps to reproduce the problem.
Expected Result
The result that you expected.
For the Pagination to not throw a warning in the console.
Actual Result
The actual result that happened 💣
Throws this warning in the console
Version
"react": "^16.13.1",
"semantic-ui-react": "^1.2.0"
Testcase
[Fork, update, and replace this pen to show the bug]:
https://codesandbox.io/s/semantic-ui-react-forked-76upj?file=/index.js
The text was updated successfully, but these errors were encountered: