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

system-field interface does not work with collection option #18192

Closed
hanneskuettner opened this issue Apr 14, 2023 · 0 comments · Fixed by #18193
Closed

system-field interface does not work with collection option #18192

hanneskuettner opened this issue Apr 14, 2023 · 0 comments · Fixed by #18193
Labels

Comments

@hanneskuettner
Copy link
Contributor

Describe the Bug

When trying to use the system-field interface (for creating options for an interface extension) the collection prop that is intended as an alternative to the collectionField to retrieve fields from that collection does not work as expected.

This is due to the form-field-interface component passing in the fields collection by default, overriding the possible value from field.meta.options.

<component
:is="componentName"
v-bind="(field.meta && field.meta.options) || {}"
:autofocus="disabled !== true && autofocus"
:disabled="disabled"
:loading="loading"
:value="modelValue === undefined ? field.schema?.default_value : modelValue"
:width="(field.meta && field.meta.width) || 'full'"
:type="field.type"
:collection="field.collection"
:field="field.field"
:field-data="field"
:primary-key="primaryKey"
:length="field.schema && field.schema.max_length"
:direction="direction"
@input="$emit('update:modelValue', $event)"
@set-field-value="$emit('setFieldValue', $event)"
/>

The system-fields (plural) interface calls the prop collectionName and it works flawlessly.

To Reproduce

Create a interface extension with the following options

options: ({ field: { collection } }) => {
		return [
			{
				field: 'my_field',
				name: 'Blocks Field',
				meta: {
					interface: 'system-field',
					options: {
						collection
					},
					width: 'half',
				},
			},
		];
	}

Create a field with the interface an observe the following error:

Screenshot 2023-04-14 at 19 21 57

Directus Version

v9.25.1

Hosting Strategy

Self-Hosted (Docker Image)

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

Successfully merging a pull request may close this issue.

2 participants