sanity-plugin-tags icon indicating copy to clipboard operation
sanity-plugin-tags copied to clipboard

Appears to be no way to remove a single-select tag

Open stephenhmarsh opened this issue 1 year ago • 1 comments

Screenshot 2024-08-13 at 8 58 51 PM

I have:

defineField({
  name: 'title',
  title: 'Title (Optional)',
  type: 'tag',
  description: "Examples: 'Author', 'Director', 'Poet in The Bronx.' Leave blank and this will default to the person's current job title.",
  options: {
    includeFromRelated: 'title',
  }
})

And it appears there is no way to set this field back to an empty value. Once set, it can only be set to another existing tag.

If I use:

  reactSelectOptions: {
    isClearable: true
  }

I can clear the field but I get an error message:

[Error] TypeError: null is not an object (evaluating 'tag._labelTemp')
(anonymous function) — mutators.ts:70
(anonymous function) — TagsInput.tsx:195
(anonymous function) — useStateManager-7e1e8489.esm.js:36
(anonymous function) — Select-49a62830.esm.js:1239
(anonymous function) — Select-49a62830.esm.js:1313
(anonymous function) — Select-49a62830.esm.js:1446
callCallback2 — react-dom.development.js:4164
dispatchEvent
invokeGuardedCallbackDev — react-dom.development.js:4213
invokeGuardedCallback — react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError — react-dom.development.js:4291
executeDispatch — react-dom.development.js:9041
processDispatchQueueItemsInOrder — react-dom.development.js:9073
processDispatchQueue — react-dom.development.js:9086
dispatchEventsForPlugins — react-dom.development.js:9097
batchedUpdates$1 — react-dom.development.js:26179
batchedUpdates — react-dom.development.js:3991
dispatchEventForPluginEventSystem — react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay — react-dom.development.js:6465
dispatchEvent — react-dom.development.js:6457:85
dispatchDiscreteEvent — react-dom.development.js:6430

	(anonymous function) (chunk-6OVX2GPT.js:152786)
	publish (people;person;EEA034FF-EE75-49DC-868B-059BAE3EF626,view=contributions;4vyIlJfwMwqB8NbLF5J3EU,template=4vyIlJfwMwqB8NbLF5J3EU,type=article;UrxBk5b8nDlnAIZv8lSYEd,type=contributor,parentRefPath=contributors%5B_key%3D%3D%22rR6aIuuM03l5E4-_4o8Ct%22%5D:25)
	(anonymous function) (people;person;EEA034FF-EE75-49DC-868B-059BAE3EF626,view=contributions;4vyIlJfwMwqB8NbLF5J3EU,template=4vyIlJfwMwqB8NbLF5J3EU,type=article;UrxBk5b8nDlnAIZv8lSYEd,type=contributor,parentRefPath=contributors%5B_key%3D%3D%22rR6aIuuM03l5E4-_4o8Ct%22%5D:59)

We are using:

"sanity": "^3.53.0",
"sanity-plugin-tags": "^2.0.2",

stephenhmarsh avatar Aug 14 '24 01:08 stephenhmarsh