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

[3.24.0] Changing locale completely crashes UI #11310

Closed
PP-Tom opened this issue Feb 20, 2025 · 1 comment
Closed

[3.24.0] Changing locale completely crashes UI #11310

PP-Tom opened this issue Feb 20, 2025 · 1 comment
Assignees

Comments

@PP-Tom
Copy link

PP-Tom commented Feb 20, 2025

Describe the Bug

Unfortunately with the new update also brings a breaking bug in which changing locale crashes the UI entirely. The error shown is:

MongoServerError: Caused by :: Write conflict during plan execution and yielding is disabled. :: Please retry your operation or multi-document transaction.

This is an error I have seen a lot in the console, however, this time it's completely crashing the UI. This is preventing deploying the update to production.

Link to the code that reproduces this issue

https://github.com/PP-Tom/payload-bugs

Reproduction Steps

  1. Change locale in top right.
  2. See error.

Image

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Payload: 3.24.0
NodeJS: 22.11.0
NextJS: 15.1.7
Database: MongoDB Atlas
@PP-Tom PP-Tom added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Feb 20, 2025
@AlessioGr AlessioGr self-assigned this Feb 20, 2025
@AlessioGr AlessioGr added status: verified If an issue has been reproduced prioritized and removed status: needs-triage Possible bug which hasn't been reproduced yet labels Feb 20, 2025
AlessioGr added a commit that referenced this issue Feb 21, 2025
…ion errors and is done correctly (#11311)

## getPreferences function caching

Our `getPreferences` function used in the ui package is now wrapped in react cache, to minimize the amount of times it runs on a single request. This mimics the behavior of our other `getPreferences` function in the next package.

## getPreferences  incorrect behavior

The `getPreferences` function in the next package was passing through the incorrect user slug. This would not have been noticeable in projects with just one users collection, but might break in projects with multiple users collections.

## getPreferences performance optimization

This PR adds `pagination: false` to the getPreferences payload.find() call, which will speed up the query.

## upsertPreferences transaction errors

Due to the potential of preference upsert operations running in parallel (e.g. when switching locales), this PR disables transactions in the preferences creation / update calls. This fixes the transaction errors reported in #11310
@AlessioGr
Copy link
Member

Fixed by #11311

@github-actions github-actions bot removed the status: verified If an issue has been reproduced label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants