Skip to content

Commit

Permalink
align explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Aug 25, 2022
1 parent 368583b commit d358281
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .changeset/views-do-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@keystone-6/core': major
---

Changes field `.views` module resolution, from a path, to a module path that can be resolved at the project's root directory
Changes field `.views` module resolution, from a path, to a module path that is resolved from where `keystone start` is run
2 changes: 1 addition & 1 deletion docs/pages/docs/apis/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Options:
See the [Hooks API](./hooks) for full details on the available hook options.
- `label`: The label displayed for this field in the Admin UI. Defaults to a human readable version of the field name.
- `ui`: Controls how the field is displayed in the Admin UI.
- `views`: A module specifier that will be resolved from the Keystone project's directory to a module containing code to replace or extend the default Admin UI components for this field. See the [Custom Field Views](../guides/custom-field-views) guide for details on how to use this option.
- `views`: A module path that is resolved from where `keystone start` is run, resolving to a module containing code to replace or extend the Admin UI components for this field. See the [Custom Field Views](../guides/custom-field-views) guide for details on how to use this option.
- `createView.fieldMode` (default: `'edit'`): Controls the create view page of the Admin UI.
Can be one of `['edit', 'hidden']`, or an async function with an argument `{ session, context }` that returns one of `['edit', 'hidden']`.
Defaults to the list's `ui.createView.defaultFieldMode` config if defined.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/admin-ui/system/createAdminMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ export function createAdminMeta(
function assertValidView(view: string, location: string) {
if (view.includes('\\')) {
throw new Error(
`${location} contains a backslash, which is invalid. You need to use a module path that can be resolved at the project's root directory (see https://github.com/keystonejs/keystone/pull/7805)`
`${location} contains a backslash, which is invalid. You need to use a module path that is resolved from where 'keystone start' is run (see https://github.com/keystonejs/keystone/pull/7805)`
);
}

if (path.isAbsolute(view)) {
throw new Error(
`${location} is an absolute path, which is invalid. You need to use a module path that can be resolved at the project's root directory (see https://github.com/keystonejs/keystone/pull/7805)`
`${location} is an absolute path, which is invalid. You need to use a module path that is resolved from where 'keystone start' is run (see https://github.com/keystonejs/keystone/pull/7805)`
);
}
}

0 comments on commit d358281

Please sign in to comment.