MCPcopy Index your code
hub / github.com/bytebase/bytebase / toggle

Function toggle

frontend/src/react/components/AccountMultiSelect.tsx:238–250  ·  view source on GitHub ↗
(fullname: string)

Source from the content-addressed store, hash-verified

236 );
237
238 const toggle = (fullname: string) => {
239 if (disabled) return;
240 const binding = fullnameToBinding(fullname);
241 if (selectedFullnames.has(fullname)) {
242 labelCacheRef.current.delete(binding);
243 onChange(value.filter((v) => v !== binding));
244 } else {
245 // Cache display label at selection time so it survives search changes
246 const label = resolveLabel(fullname);
247 if (label) labelCacheRef.current.set(binding, label);
248 onChange([...value, binding]);
249 }
250 };
251
252 const remove = (binding: string) => {
253 if (disabled) return;

Callers 1

AccountMultiSelectFunction · 0.85

Calls 4

fullnameToBindingFunction · 0.85
resolveLabelFunction · 0.70
deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected