keystonejs / keystonejs/keystone

Custom relationship field view not resolving in Admin UI build

Open
#9,287 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10k
Forks
1.3k
Avg merge
19h 14m
Merged PRs (30d)
19

Description

When trying to use a custom view for a relationship field in the Admin UI, the build process fails due to a module resolution error. The custom view file is not being correctly resolved during the Next.js build process that Keystone uses for the Admin UI. it works in development mode.

create a custom view, and use it in the schema
like example https://github.com/keystonejs/keystone/blob/main/examples/custom-field-view/schema.ts#L27
```
agent: relationship({
ui: {
labelField: "identityCode",
displayMode: "select",
views: "../components/FilteredRelationship.tsx",

```

it shold build without any error

Screenshot 2024-08-13 at 5 42 17 PM

here is package.json

```
"dependencies": {
"@keystone-6/auth": "^7.0.0",
"@keystone-6/core": "^5.0.0",
"@keystone-6/document-renderer": "^1.1.2",
"@keystone-6/fields-document": "^7.0.0",
"react-infinite-scroll-component": "^6.1.0",
"slate": "^0.103.0",
"slate-history": "^0.100.0",
"slate-react": "^0.107.1",
"typescript": "^4.9.5",
"uuid": "^10.0.0"
}

```

Contributor guide

Open the contributing guide

Research direction

Start with examples/custom-field-view/schema.ts and the referenced custom view path, then trace the Admin UI Next.js build and its module-resolution error. Reproduce the build using the relationship field configuration; done means the custom relationship view resolves and the build completes without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.