remove callback works now haha lol

This commit is contained in:
Carter 2025-04-24 14:48:32 -06:00
parent ecc2f4d851
commit 988ab1c683
3 changed files with 5 additions and 13 deletions

View file

@ -47,11 +47,12 @@ interface Props {
devices: Device[];
permissions: pond.Permission[];
refreshCallback: () => void;
removeCallback?: () => void;
}
export default function GroupActions(props: Props) {
const classes = useStyles();
const { group, permissions, refreshCallback, devices } = props;
const { group, permissions, refreshCallback, devices, removeCallback } = props;
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const [groupSettingsOpen, setGroupSettingsOpen] = useState(false);
const [shareOpen, setShareOpen] = useState(false);
@ -142,6 +143,7 @@ export default function GroupActions(props: Props) {
isDialogOpen={groupSettingsOpen}
refreshCallback={refreshCallback}
closeDialogCallback={() => setGroupSettingsOpen(false)}
removeGroupCallback={removeCallback}
groupDevices={devices}
/>
<ShareObject

View file

@ -102,7 +102,7 @@ export default function GroupSettings(props: Props) {
// Update ref when prop changes
useEffect(() => {
console.log("Updating removeCallbackRef with:", removeGroupCallback);
removeCallbackRef.current = removeGroupCallback;
if (removeGroupCallback) removeCallbackRef.current = removeGroupCallback;
}, [removeGroupCallback]);
useEffect(() => {

View file

@ -492,23 +492,13 @@ export default function Devices() {
onRowClick={toDevice}
setSearchText={setSearch}
isLoading={devicesLoading}
actions={getGroup() && <GroupActions group={getGroup()} permissions={groupPermissions} devices={devices} refreshCallback={loadDevices}/>}
actions={getGroup() && <GroupActions removeCallback={removeGroupCallback} group={getGroup()} permissions={groupPermissions} devices={devices} refreshCallback={loadDevices}/>}
/>
<ProvisionDevice
isOpen={isProvisionDialogOpen}
refreshCallback={loadDevices}
closeDialogCallback={closeProvisionDialog}
/>
<GroupSettings
initialGroup={selectedGroup}
mode={groupSettingsMode}
isDialogOpen={groupSettingsIsOpen}
closeDialogCallback={closeGroupSettings}
refreshCallback={loadDevices}
canEdit={true}
groupDevices={devices}
removeGroupCallback={removeGroupCallback}
/>
</PageContainer>
)
}