-
Notifications
You must be signed in to change notification settings - Fork 2.8k
WIP: Save limit value in localStorage #3850
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
Conversation
|
Beep boop! 🤖 Hey @polRk, thanks for your PR! One of my human friends will review this PR and get back to you as soon as possible. Stay awesome! 😎 |
|
Review app for commit 7609d37 deployed to Heroku: https://hge-ci-pull-3850.herokuapp.com |
|
Deploy preview for hasura-docs ready! Built with commit ecf083b |
|
Deploy preview for hasura-docs ready! Built with commit 10ee273 |
|
@hasura-bot deploy |
|
/heroku deploy |
|
Review app for commit 5e5a2fc deployed to Heroku: https://hge-ci-pull-3850.herokuapp.com |
|
@polRk Thanks for taking this issue up and contributing. I just had some feedback on the UX. Instead of adding a new page in the setting section to set the default pageSize value, it would just suffice to persist the page size value when the user updates the page size on the browse rows page itself. If user sets page value to 20, then we persist that value and show 20 results always from then on. |
|
@rikinsk Looks pretty good. I'll try to finish it soon |
|
/heroku deploy |
|
@polRk you don't have enough permissions to execute this command |
|
Review app for commit 324520f deployed to Heroku: https://hge-ci-pull-3850.herokuapp.com |
|
Review app for commit 1f914bf deployed to Heroku: https://hge-ci-pull-3850.herokuapp.com |
|
@beerose Can you make a review ? |
|
I'll do the review first thing tomorrow morning.
…On Tue, 11 Feb 2020 at 14:44, Vladislav Polyakov ***@***.***> wrote:
@beerose <https://github.com/beerose> Can you make a review ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3850?email_source=notifications&email_token=ACE2ABOPEPOXNXYAFBKSGOTRCKTTPA5CNFSM4KRMSG62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELMOQSQ#issuecomment-584640586>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACE2ABP3J74BEXO32FTZDJTRCKTTPANCNFSM4KRMSG6Q>
.
|
beerose
left a comment
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.
Hi @polRk. Thank you for your contribution!
Your code is working fine, but I see some problems with the implementation.
The content of the DataState.js is a pure state of the app, where we don't want to introduce any side effects. Thus, it's not the place for accessing the local storage.
Instead, take a look at this file and componentDidMount method: https://github.com/polRk/graphql-engine/blob/master/console/src/components/Services/Data/TableBrowseRows/FilterQuery.js#L173
Here, we are setting the default values, so this is the proper place for taking the limit from localStorage and passing it as a default limit:
dispatch(setDefaultQuery({ where, order_by, limit }));Another thing is how you access the Local Storage. We don't want to do it directly from the components or reducers. Instead, we rather create some abstractions for Local Storage. Take a look at this file: https://github.com/hasura/graphql-engine/pull/3753/files#diff-7d6f61aee8febe1d54e2e517ca909792R1 .
It would be ideal if you'd make this PR a part of #3753 (by changing the base), which adds similar functionality -- it also makes some settings persistent.
| query: { | ||
| columns: [], | ||
| limit: 10, | ||
| limit: parseInt(localStorage.getItem('console:queryLimit') || 10, 10), |
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.
| limit: parseInt(localStorage.getItem('console:queryLimit') || 10, 10), | |
| limit: 10 |
| const defaultCurFilter = { | ||
| where: { $and: [{ '': { '': '' } }] }, | ||
| limit: 10, | ||
| limit: parseInt(localStorage.getItem('console:queryLimit') || 10, 10), |
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.
| limit: parseInt(localStorage.getItem('console:queryLimit') || 10, 10), | |
| limit: 10 |
| ...defaultViewState, | ||
| query: { | ||
| columns: currentColumns, | ||
| limit: 10, |
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.
Don't delete this line.
| where: { delivered: false, error: false }, | ||
| }, | ||
| ], | ||
| limit: 10, |
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.
Don't delete this line.
|
@beerose How can i change the base ? |
|
Review app for commit 05e2ede deployed to Heroku: https://hge-ci-pull-3850.herokuapp.com |
|
@polRk You would need to create a new PR and choose my fork and But what happened here? |
I made a rebase to get new code from the master branch. Standard practice |
I think something went wrong here because you have 706 commits to merge.
|
I rebased wrong master. Solved, thank you |
|
Review app for commit 1df76bb deployed to Heroku: https://hge-ci-pull-3850.herokuapp.com |
|
Hi @polRk! It's been a while since your last commit, so I want to ask if you still plan to work on this PR? |
|
Hi @beerose! I don’t have enough time for this PR. I want to make hasura console better, if someone can to do this faster than me, it will be good. Sorry for waiting |
|
Closing in favor of #4323. |
|
Review app https://hge-ci-pull-3850.herokuapp.com is deleted |
|
Beep boop! 🤖 Hey @polRk! Sorry that your PR wasn’t merged. Do take a look at any of the other open issues to see if you’d like to take something up! We’re around on Discord if you have any questions 😄 |
Description
Put a separate option in the settings tab.
Save pageSize default value in localStorage.
Load page Size default value in Browser Rows view
Affected components
Related Issues
#3849
Solution and Design