staff-tags: fix existingTag lookup in member list, bump to 1.0.10
1.0.9 fixed the pairing bug and correctly located ret.props.label, but still used findInReactFiber to search within it for the existing BotTag element - confirmed live that findInReactFiber never matches here. It's built for real React fiber nodes, not the plain element tree innerRender() returns pre-reconciliation, so it silently found nothing and every row bailed out before ever calling getTag(). Since label.props.children is already a known flat array, a direct .find() locates the same BotTag element findInReactFiber was missing. Live end-to-end verified: OWNER tag now renders correctly in the member list for the actual guild owner.
This commit is contained in:
parent
abd21f3be1
commit
13800ddf01
2 changed files with 13 additions and 7 deletions
|
|
@ -1,8 +1,6 @@
|
|||
import { Stores } from '@revenge-mod/discord/flux'
|
||||
import { getModules } from '@revenge-mod/modules/finders'
|
||||
import { afterJSX } from '@revenge-mod/react/jsx-runtime'
|
||||
import { findInReactFiber } from '@revenge-mod/utils/react'
|
||||
import { fiberFilter } from '../lib/fiber'
|
||||
import { withMemoDefaultName } from '../lib/filters'
|
||||
import getTag from '../lib/getTag'
|
||||
import { guard } from '../lib/safe'
|
||||
|
|
@ -107,10 +105,18 @@ export default function patchDetails(storage: JsonStorage<StaffTagsStorage>) {
|
|||
| undefined
|
||||
if (!label || !Array.isArray(label.props?.children)) return ret
|
||||
|
||||
const existingTag = findInReactFiber(
|
||||
label as any,
|
||||
fiberFilter(c => c?.type?.Types),
|
||||
)
|
||||
// A plain array `.find()`, not `findInReactFiber` - confirmed live that
|
||||
// `findInReactFiber` doesn't match here. It's built for real React fiber
|
||||
// nodes (`.child`/`.sibling`/`.return`), not the plain element tree `ret`
|
||||
// actually is at this point (`innerRender`'s return value, pre-reconciliation
|
||||
// - createElement() output, not yet a fiber). `label.props.children` is a
|
||||
// flat, already-known array, so a direct search needs no fiber-walking helper.
|
||||
const existingTag = (
|
||||
label.props.children as {
|
||||
type?: { Types?: unknown }
|
||||
props?: any
|
||||
}[]
|
||||
).find(c => c?.type?.Types)
|
||||
if (existingTag && existingTag.props?.type !== 0) return ret
|
||||
|
||||
const guild = GuildStore?.getGuild(guildId)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"name": "Staff Tags",
|
||||
"description": "Adds customizable tags (OWNER, ADMIN, STAFF, MOD, and more) next to members based on their server permissions. Supports per-tag colors, gradients, custom text, and visibility toggles.",
|
||||
"author": "Rosie",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"dependencies": {
|
||||
"revenge.api": {
|
||||
"version": ">=1 <2"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue