fix: delete provider crash
This commit is contained in:
parent
17c3437e02
commit
925a9fb8ec
@ -47,7 +47,7 @@ export function useProvider(id: string) {
|
||||
|
||||
return {
|
||||
provider,
|
||||
models: provider.models,
|
||||
models: provider?.models || [],
|
||||
updateProvider: (provider: Provider) => dispatch(updateProvider(provider)),
|
||||
addModel: (model: Model) => dispatch(addModel({ providerId: id, model })),
|
||||
removeModel: (model: Model) => dispatch(removeModel({ providerId: id, model }))
|
||||
|
||||
@ -94,7 +94,7 @@ export function droppableReorder<T>(list: T[], startIndex: number, endIndex: num
|
||||
}
|
||||
|
||||
export function firstLetter(str: string): string {
|
||||
const match = str.match(/\p{L}\p{M}*|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/u)
|
||||
const match = str?.match(/\p{L}\p{M}*|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/u)
|
||||
return match ? match[0] : ''
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user