fix(components): [message] max affects grouping display (#18189)

fix(components): [message] Fix message grouping with max limit

Prioritize grouping logic over max limit in message component

closed #18117
This commit is contained in:
Manshu Tusker 2024-09-06 09:02:45 +08:00 committed by GitHub
parent 0760b06b18
commit 2dbe2bf4af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,10 +158,6 @@ const message: MessageFn &
) => { ) => {
if (!isClient) return { close: () => undefined } if (!isClient) return { close: () => undefined }
if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
return { close: () => undefined }
}
const normalized = normalizeOptions(options) const normalized = normalizeOptions(options)
if (normalized.grouping && instances.length) { if (normalized.grouping && instances.length) {
@ -175,6 +171,10 @@ const message: MessageFn &
} }
} }
if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
return { close: () => undefined }
}
const instance = createMessage(normalized, context) const instance = createMessage(normalized, context)
instances.push(instance) instances.push(instance)