mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 22:07:55 +00:00
fix render loop
This commit is contained in:
parent
967dfea182
commit
278f3f96f8
2 changed files with 27 additions and 17 deletions
|
|
@ -113,6 +113,8 @@ export default function MemberCard(props) {
|
|||
}, [member.description, member.color, member.birthday, member.display_name, member.pronouns, member.avatar_url, member.proxy_tags]);
|
||||
|
||||
const submitEdit = data => {
|
||||
props.edit(Object.assign(member, data));
|
||||
|
||||
fetch(`${API_URL}m/${member.id}`,{
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
|
|
@ -132,6 +134,8 @@ export default function MemberCard(props) {
|
|||
}
|
||||
|
||||
const submitPrivacy = data => {
|
||||
props.edit(Object.assign(member, data));
|
||||
|
||||
fetch(`${API_URL}m/${member.id}`,{
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
|
|
@ -181,6 +185,7 @@ export default function MemberCard(props) {
|
|||
const submitProxy = data => {
|
||||
|
||||
const newdata = {proxy_tags: data.proxy_tags.filter(tag => !(tag.prefix === "" && tag.suffix === ""))}
|
||||
props.edit(Object.assign(member, newdata));
|
||||
|
||||
fetch(`${API_URL}m/${member.id}`,{
|
||||
method: 'PATCH',
|
||||
|
|
@ -191,8 +196,8 @@ export default function MemberCard(props) {
|
|||
}}).then (res => res.json()
|
||||
).then (data => {
|
||||
setMember(prevState => {return {...prevState, ...data}});
|
||||
setProxyTags(data.proxy_tags);
|
||||
setErrorAlert(false)
|
||||
setProxyTags(data.proxy_tags);
|
||||
setErrorAlert(false);
|
||||
setProxyMode(false);
|
||||
}
|
||||
).catch (error => {
|
||||
|
|
@ -202,14 +207,6 @@ export default function MemberCard(props) {
|
|||
}
|
||||
|
||||
const didMount = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (didMount.current) {
|
||||
props.edit(member);
|
||||
} else {
|
||||
didMount.current = true;
|
||||
}
|
||||
}, [props, member]);
|
||||
|
||||
function copyLink() {
|
||||
var link = `https://spectralitree.github.io/pk-webs/profile/${sysID}/${member.id}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue