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

getDataByPath on empty array fields return 0 instead of [] #10712

Open
tyteen4a03 opened this issue Jan 21, 2025 · 0 comments · May be fixed by #11283
Open

getDataByPath on empty array fields return 0 instead of [] #10712

tyteen4a03 opened this issue Jan 21, 2025 · 0 comments · May be fixed by #11283

Comments

@tyteen4a03
Copy link
Contributor

Describe the Bug

Since 3.18.0, getDataByPath on empty array fields return 0 instead of [].

Link to the code that reproduces this issue

https://github.com/tyteen4a03/payload-getdatabypath-bug

Reproduction Steps

  1. Create a new Media entry. The UI component console.log() logs the result as 0.
  2. Downgrade Payload to 3.17.1.
  3. The same code path now logs the result as [] which is the correct behavior.

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

area: ui

Environment Info

Node.js v22.12.0

Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  payload: 3.18.0
  next: 15.1.5
  @payloadcms/db-mongodb: 3.18.0
  @payloadcms/email-nodemailer: 3.18.0
  @payloadcms/graphql: 3.18.0
  @payloadcms/next/utilities: 3.18.0
  @payloadcms/payload-cloud: 3.18.0
  @payloadcms/richtext-lexical: 3.18.0
  @payloadcms/translations: 3.18.0
  @payloadcms/ui/shared: 3.18.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
@tyteen4a03 tyteen4a03 added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 21, 2025
@PatrikKozak PatrikKozak self-assigned this Feb 19, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants