Merge pull request #19391 from overleaf/rh-readd-collaborator
[web] Re-add collaborator email after removed from invite input GitOrigin-RevId: 629ac28292978d24323ff2ba53ae1c9987bce9a2
This commit is contained in:
+10
@@ -77,6 +77,15 @@ export default function SelectCollaborators({
|
||||
return true
|
||||
}, [inputValue, selectedItems])
|
||||
|
||||
function stateReducer(state, actionAndChanges) {
|
||||
const { type, changes } = actionAndChanges
|
||||
// force selected item to be null so that adding, removing, then re-adding the same collaborator is recognised as a selection change
|
||||
if (type === useCombobox.stateChangeTypes.InputChange) {
|
||||
return { ...changes, selectedItem: null }
|
||||
}
|
||||
return changes
|
||||
}
|
||||
|
||||
const {
|
||||
isOpen,
|
||||
getLabelProps,
|
||||
@@ -91,6 +100,7 @@ export default function SelectCollaborators({
|
||||
defaultHighlightedIndex: 0,
|
||||
items: filteredOptions,
|
||||
itemToString: item => item && item.name,
|
||||
stateReducer,
|
||||
onStateChange: ({ inputValue, type, selectedItem }) => {
|
||||
switch (type) {
|
||||
// add a selected item on Enter (keypress), click or blur
|
||||
|
||||
+10
@@ -77,6 +77,15 @@ export default function SelectCollaborators({
|
||||
return true
|
||||
}, [inputValue, selectedItems])
|
||||
|
||||
function stateReducer(state, actionAndChanges) {
|
||||
const { type, changes } = actionAndChanges
|
||||
// force selected item to be null so that adding, removing, then re-adding the same collaborator is recognised as a selection change
|
||||
if (type === useCombobox.stateChangeTypes.InputChange) {
|
||||
return { ...changes, selectedItem: null }
|
||||
}
|
||||
return changes
|
||||
}
|
||||
|
||||
const {
|
||||
isOpen,
|
||||
getLabelProps,
|
||||
@@ -91,6 +100,7 @@ export default function SelectCollaborators({
|
||||
defaultHighlightedIndex: 0,
|
||||
items: filteredOptions,
|
||||
itemToString: item => item && item.name,
|
||||
stateReducer,
|
||||
onStateChange: ({ inputValue, type, selectedItem }) => {
|
||||
switch (type) {
|
||||
// add a selected item on Enter (keypress), click or blur
|
||||
|
||||
Reference in New Issue
Block a user