AlwaysExpandRoles: Fix collapse roles button not appearing
This commit is contained in:
parent
af1edc88bf
commit
211569f7f5
1 changed files with 12 additions and 4 deletions
|
@ -28,10 +28,18 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: 'action:"EXPAND_ROLES"',
|
find: 'action:"EXPAND_ROLES"',
|
||||||
replacement: {
|
replacement: [
|
||||||
match: /(roles:\i(?=.+?(\i)\(!0\)[,;]\i\({action:"EXPAND_ROLES"}\)).+?\[\i,\2\]=\i\.useState\()!1\)/,
|
{
|
||||||
replace: (_, rest, setExpandedRoles) => `${rest}!0)`
|
match: /(roles:\i(?=.+?(\i)\(!0\)[,;]\i\({action:"EXPAND_ROLES"}\)).+?\[\i,\2\]=\i\.useState\()!1\)/,
|
||||||
}
|
replace: (_, rest, setExpandedRoles) => `${rest}!0)`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Fix not calculating non-expanded roles because the above patch makes the default "expanded",
|
||||||
|
// which makes the collapse button never show up and calculation never occur
|
||||||
|
match: /(?<=useLayoutEffect\(\(\)=>{if\()\i/,
|
||||||
|
replace: isExpanded => "false"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue