Skip to content

Conversation

@philipp-tailor
Copy link
Contributor

Replaces a more elaborate approach from #11520 with the simplest solution, just changing the default.

GermanJablo
GermanJablo previously approved these changes Mar 20, 2025
Copy link
Contributor

@GermanJablo GermanJablo left a comment

Choose a reason for hiding this comment

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

I made a small adjustment. Thanks!

@GermanJablo GermanJablo enabled auto-merge (squash) March 20, 2025 15:22
Copy link
Contributor Author

@philipp-tailor philipp-tailor left a comment

Choose a reason for hiding this comment

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

I made a small adjustment. Thanks!

@GermanJablo thank you!

if (!modifiedOnly) {
current.delete('modifiedOnly')
if (modifiedOnly === false) {
current.set('modifiedOnly', 'false')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@GermanJablo Doesn't this change mean that every time the versions list is opened, there will be a client side routing adding the ?modifiedOnly=false query parameter?

IMHO query params should only indicate differences from the default state. Pushing URL changes trigger downstream effects like unnecessary route related computing and possibly re-rendering. That's why I didn't go for changing the URL query params in my initial commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, because modifiedOnly is now true by default. When you open the version list, it will be true, and therefore this condition won't be executed. To be sure, I've verified this with a console.log.

IMHO, query params should only indicate differences from the default state.

That's exactly what I'm doing now. Again, keep in mind that modifiedOnly is now true by default, so we only want to have false in the URL.

The conditions here are only for changing the state when the checkbox is checked or unchecked.

Your initial commit also had a bug where if you manually wrote modifiedOnly in the URL (I don't remember if it was with true, false, or both), the state wasn't reflected correctly.

@GermanJablo GermanJablo disabled auto-merge March 21, 2025 16:39
@GermanJablo
Copy link
Contributor

this PR broke some tests. Can you fix that @philipp-tailor ?

Replaces a more elaborate approach from payloadcms#11520 with the simplest
solution, just changing the default.

Co-authored-by: @GermanJablo
@philipp-tailor
Copy link
Contributor Author

@GermanJablo I don't know how the earlier version with your commit did break the complete test suite, but I can confirm that it also didn't work for me locally, same as in CI. I re-created the same changes anew, and force pushed, which un-broke the test suite, uncovering 1 test, which I fixed in 385093d. Now there's still 1 E2E test that is failing. However that test is entirely unrelated to this code change. I hope it's possible for you to approve and merge given that the test failure is unrelated?

Copy link
Contributor

@GermanJablo GermanJablo left a comment

Choose a reason for hiding this comment

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

Thank you @philipp-tailor !

@GermanJablo GermanJablo merged commit 21f7ba7 into payloadcms:main Mar 27, 2025
74 checks passed
kendelljoseph pushed a commit that referenced this pull request Mar 31, 2025
Replaces a more elaborate approach from
#11520 with the simplest
solution, just changing the default.
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2025

🚀 This is included in version v3.32.0

Bjornnyborg pushed a commit to Bjornnyborg/payload that referenced this pull request Apr 16, 2025
…s#11794)

Replaces a more elaborate approach from
payloadcms#11520 with the simplest
solution, just changing the default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants