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

feat: add "on this page" to empty table message when you're past page 1 #4886

Merged
merged 9 commits into from
Nov 8, 2022

Conversation

presleyp
Copy link
Contributor

@presleyp presleyp commented Nov 3, 2022

If a saved url takes a user to a page beyond the number of records they have, they see an empty table. The message in the empty table should point out that they might not have no records at all; they just don't have any on this page. So I added an empty-page treatment to the currently paginated pages: workspaces, users, and audit log. I ended up going with this solution over a redirect because I don't think a redirect is always the best behavior, and it was hard to single out just the on-mount cases (since I don't know we have no results until after the fetch).

I added stories for each as well, and in order to do that I needed to prop-drill because the query-params storybook add-on doesn't work for some reason.

While I was in there I switched to ChooseOne, making it a little clearer that each page has a 3-way choice, and switched from Language to i18n.

@presleyp presleyp requested a review from a team as a code owner November 3, 2022 22:52
@presleyp presleyp requested review from code-asher and removed request for a team November 3, 2022 22:52
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Works perfectly! I love how clear the ChooseOne makes things.

}
> = ({ isLoading, workspaceRefs, filter, isNonInitialPage }) => {
const { t } = useTranslation("workspacesPage")
console.log(isNonInitialPage)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log(isNonInitialPage)


export const Empty = Template.bind({})
Empty.args = { ...Admin.args, users: [] }
Empty.args = { users: [] }
Copy link
Member

Choose a reason for hiding this comment

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

I think not having isNonInitialPage here is causing Cond to error with A non-final Cond in a ChooseOne does not have a condition prop..

@presleyp presleyp merged commit 87b3fe1 into main Nov 8, 2022
@presleyp presleyp deleted the page-empty/presleyp branch November 8, 2022 16:08
@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants