Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Add settings history.defaultPageSize#44651

Merged
indradhanush merged 5 commits into
mainfrom
ig/custom-history-page-size
Nov 28, 2022
Merged

Add settings history.defaultPageSize#44651
indradhanush merged 5 commits into
mainfrom
ig/custom-history-page-size

Conversation

@indradhanush

@indradhanush indradhanush commented Nov 21, 2022

Copy link
Copy Markdown
Contributor

Fixed #44431.

history.defaultPageSize.mp4

Note about returning 2x the responses on clicking the Show more button:

  • This is the existing behaviour and unchanged
  • Initially we load say 5 commits
  • Next time it fetched 10 commits, so visually it looks like 5 commits were fetched (the API doesn't support pagination yet)
  • Then it fetches 20 commits which is why visually it looks like 10 new commits were fetched and thus the doubling of the commits from this point on

Test plan

Tested functionality locally.
Builds (should) pass.

@cla-bot cla-bot Bot added the cla-signed label Nov 21, 2022
@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Nov 21, 2022

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.00% (+0.39 kb) 0.00% (+0.39 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits ecf86bf and 6bdfb4b or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@indradhanush indradhanush requested a review from a team November 21, 2022 10:29
@indradhanush indradhanush marked this pull request as ready for review November 21, 2022 10:29

@sashaostrikov sashaostrikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@ryanslade

Copy link
Copy Markdown
Contributor

The doubling up behaviour is weird. In your example of fetching 5 commits I would expect it to fetch 5, 10, 15, 20 etc commits each time you click "show more" so that it looks like it's loading 5 new commits each time.

It looks like the increments themselves are going up which is a weird user experience. It was easy to spot near the end of your demo where you set the page size to 2. Is this the existing behaviour you mentioned?

@indradhanush

Copy link
Copy Markdown
Contributor Author

@ryanslade Right. Ideally it should be in increments of 5 if the page size is set to 5. But the current behaviour on dotcom says otherwise. The page size is 100 and by the third request we fetch 400 instead of 300 commits.

image

The existing behaviour is not changing but with a smaller page size, this is more pronounced.

Comment thread schema/settings.schema.json Outdated
"history.defaultPageSize": {
"description": "Custom page size for the history tab. If set, the history tab will populate that number of commits at a time. If not set, it will populate 100 commits at a time.",
"type": "integer",
"default": 100,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you set a default here then that will be used and the value is never undefined in JS, correct? Does it make sense to set a default here? Or should we not set one in JS if we have it here?

@indradhanush indradhanush Nov 21, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. I think to ease off the confusion of having a default value for a value that is named defaultPageSize, maybe we should remove the default from the schema config.

@ryanslade

Copy link
Copy Markdown
Contributor

The existing behaviour is not changing but with a smaller page size, this is more pronounced.

I wonder if we should change this? It's the sort of thing that will probably come back to us as a bug report.

@mrnugget

Copy link
Copy Markdown
Contributor

I wonder if we should change this? It's the sort of thing that will probably come back to us as a bug report.

➕ on this. But I'd vote to have this in a separate PR. There's also efforts going on to improve pagination (cc @thenamankumar) so let's make sure to not step on each other's toes.

@0xnmn

0xnmn commented Nov 23, 2022

Copy link
Copy Markdown
Contributor

@ryanslade @mrnugget I think the current behaviour was implemented as a UX improvement which might not look like one to us at the moment. But we should discuss this with the design team first before planning on removing it as the FilteredConnection component, which implements this logic, is used at multiple places.

@mrnugget

Copy link
Copy Markdown
Contributor

@thenamankumar thanks for the reminder. Yes, agree. I thought it was a legitimate bug, but just watched the video and agree, this seems like the intended behaviour, even though it's weird.

@indradhanush indradhanush merged commit 5ec82ed into main Nov 28, 2022
@indradhanush indradhanush deleted the ig/custom-history-page-size branch November 28, 2022 06:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a configurable where admins can set a default page limit on the file history commits, and users can configure their own.

6 participants