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

Fix access.filter.* passing listKey: undefined #8122

Merged
merged 3 commits into from
Nov 24, 2022
Merged

Conversation

dcousens
Copy link
Member

@dcousens dcousens commented Nov 24, 2022

Fixes #8121 where access.filter.* operations were being passed list: list.listKey instead of listKey: list.listKey.

The typo fell through our types because we had an as any with the type being difficult to resolve.
Prior to c740ba6 we had @ts-ignore for this check:

// @ts-ignore
let filters = typeof access === 'function' ? await access(args) : access;
if (typeof filters === 'boolean') {
return filters;
}

And then with #7914 we changed it to as any and introduced the regression (as shown in the pull request diff).

With this pull request, we resolve the types verbosely. Not ideal, but, it's better than the alternative.

@changeset-bot

This comment was marked as resolved.

@vercel
Copy link

vercel bot commented Nov 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview Nov 24, 2022 at 11:19AM (UTC)

session: context.session,
list: list.listKey,
context,
} as any); // TODO: FIXME
Copy link
Member Author

Choose a reason for hiding this comment

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

🔥

session: context.session,
listKey: list.listKey,
context,
});
Copy link
Member Author

Choose a reason for hiding this comment

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

Verbose, but, at least it type checks

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4d4ea09:

Sandbox Source
@keystone-6/sandbox Configuration

@vercel vercel bot temporarily deployed to Preview November 24, 2022 11:19 Inactive
@dcousens dcousens enabled auto-merge (squash) November 24, 2022 11:24
@dcousens dcousens requested review from flexdinesh and a team November 24, 2022 11:25
@dcousens dcousens self-assigned this Nov 24, 2022
@dcousens dcousens merged commit 40dec60 into main Nov 24, 2022
@dcousens dcousens deleted the fix-bad-listkey branch November 24, 2022 12:00
dcousens added a commit that referenced this pull request Nov 25, 2022
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com>
@dcousens
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list.access.filter.query "listKey" is undefined... but did get a "list" parameter
2 participants