add an instant cache refresh to the editor

This commit is contained in:
41666 2022-02-04 11:59:11 -05:00
parent 68b2b7323b
commit 0836d548b2
6 changed files with 66 additions and 11 deletions

View file

@ -15,7 +15,14 @@ import { flatten, sortBy } from 'lodash';
import React from 'react';
import { DragDropContext, Draggable, Droppable, DropResult } from 'react-beautiful-dnd';
import { CgReorder } from 'react-icons/cg';
import { GoArrowDown, GoArrowUp, GoCheck, GoGrabber, GoPlus } from 'react-icons/go';
import {
GoArrowDown,
GoArrowUp,
GoCheck,
GoGrabber,
GoPlus,
GoSync,
} from 'react-icons/go';
import { ulid } from 'ulidx';
import {
CategoryActions,
@ -26,6 +33,7 @@ import {
type Props = {
guild: PresentableGuild;
onChange: (categories: PresentableGuild['data']['categories']) => void;
onRefreshCache?: () => void;
};
const resetOrder = (categories: Category[]) =>
@ -126,6 +134,9 @@ export const ServerCategoryEditor = (props: Props) => {
<Button color="muted" size="small" onClick={() => setReorderMode(true)}>
Change Order <CgReorder />
</Button>
<Button color="muted" size="small" onClick={props.onRefreshCache}>
Refresh Roles <GoSync />
</Button>
</CategoryActions>
{props.guild.data.categories.length > 0 ? (
sortBy(props.guild.data.categories, ['position', 'id']).map((category, idx) => (