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

args.id in a access callback is of type string at load and number at save #8218

Open
mattiaz9 opened this issue Sep 14, 2024 · 2 comments
Open
Assignees
Labels
stale status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@mattiaz9
Copy link

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: N/A
  pnpm: 9.10.0
Relevant Packages:
  payload: 3.0.0-beta.104
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12

Describe the Bug

There is this inconsistency with the type of args.id inside an access callback.
When the page is loaded is a string type but when the save action is performed is a number type (as it always should).

Reproduction Steps

const adminOrSelf: Access = (args) => {
  console.log(typeof args.id)
  return admin(args) || (!!args.req.user && args.id === args.req.user.id)
}

const Users: CollectionConfig = {
  slug: "users",
  access: {
    update: adminOrSelf,
  }
}

Adapters and Plugins

No response

@mattiaz9 mattiaz9 added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Sep 14, 2024
@JarrodMFlesch JarrodMFlesch self-assigned this Oct 17, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 17, 2024
@denolfe denolfe removed the v3 label Nov 19, 2024
Copy link
Contributor

This issue has been marked as stale due to lack of activity.

To keep this issue open, please indicate that it is still relevant in a comment below.

@github-actions github-actions bot added the stale label Dec 13, 2024
Copy link
Contributor

This issue was automatically closed due to lack of activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2024
@denolfe denolfe reopened this Dec 21, 2024
@github-actions github-actions bot added the status: needs-triage Possible bug which hasn't been reproduced yet label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

3 participants