Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "8.8.0",
"version": "8.8.1",
"author": "CIPP Contributors",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down Expand Up @@ -118,4 +118,4 @@
"eslint": "9.35.0",
"eslint-config-next": "15.5.2"
}
}
}
4 changes: 2 additions & 2 deletions public/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "8.8.0"
}
"version": "8.8.1"
}
8 changes: 4 additions & 4 deletions src/components/CippComponents/CippTenantSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export const CippTenantSelector = (props) => {

// This effect handles when the URL parameter changes externally
useEffect(() => {
if (!router.isReady || !tenantList.isSuccess) return;
if (!router.isReady || !tenantList.isSuccess || !settings.isInitialized) return;

// Get the current tenant from URL or settings
const urlTenant = router.query.tenantFilter || settings.currentTenant;
Expand All @@ -230,11 +230,11 @@ export const CippTenantSelector = (props) => {
});
}
}
}, [router.isReady, router.query.tenantFilter, tenantList.isSuccess, settings.currentTenant]);
}, [router.isReady, router.query.tenantFilter, tenantList.isSuccess, settings.currentTenant, settings.isInitialized]);

// This effect ensures the tenant filter parameter is included in the URL when missing
useEffect(() => {
if (!router.isReady || !settings.currentTenant) return;
if (!router.isReady || !settings.isInitialized || !settings.currentTenant) return;

// If the tenant parameter is missing from the URL but we have it in settings
if (!router.query.tenantFilter && settings.currentTenant) {
Expand All @@ -248,7 +248,7 @@ export const CippTenantSelector = (props) => {
{ shallow: true }
);
}
}, [router.isReady, router.query, settings.currentTenant]);
}, [router.isReady, router.query, settings.currentTenant, settings.isInitialized]);

useEffect(() => {
if (tenant && currentTenant?.value && currentTenant?.value !== "AllTenants") {
Expand Down
12 changes: 10 additions & 2 deletions src/contexts/settings-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,22 @@ export const SettingsProvider = (props) => {

const handleUpdate = useCallback((settings) => {
setState((prevState) => {
// Filter out null and undefined values to prevent resetting settings
const filteredSettings = Object.entries(settings).reduce((acc, [key, value]) => {
if (value !== null && value !== undefined) {
acc[key] = value;
}
return acc;
}, {});

storeSettings({
...prevState,
...settings,
...filteredSettings,
});

return {
...prevState,
...settings,
...filteredSettings,
};
});
}, []);
Expand Down
1 change: 1 addition & 0 deletions src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ const App = (props) => {
<SettingsConsumer>
{(settings) => {
if (!settings.isInitialized) {
return null; // Don't render until settings are loaded
}
const theme = createTheme({
colorPreset: "orange",
Expand Down
3 changes: 2 additions & 1 deletion src/pages/tenant/manage/applied-standards.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const Page = () => {
const { templateId } = router.query;
const [comparisonData, setComparisonData] = useState(null);
const settings = useSettings();
const currentTenant = settings?.currentTenant;
// Prioritize URL query parameter, then fall back to settings
const currentTenant = router.query.tenantFilter || settings?.currentTenant;
const formControl = useForm({
mode: "onBlur",
defaultValues: {
Expand Down
13 changes: 9 additions & 4 deletions src/pages/tenant/manage/configuration-backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ const Page = () => {
const { templateId } = router.query;
const settings = useSettings();
const removeDialog = useDialog();
// Prioritize URL query parameter, then fall back to settings
const currentTenant = router.query.tenantFilter || settings.currentTenant;

// API call to get backup files
const backupList = ApiGetCall({
url: "/api/ExecListBackup",
data: {
tenantFilter: settings.currentTenant,
tenantFilter: currentTenant,
Type: "Scheduled",
NameOnly: true,
},
queryKey: `BackupList-${settings.currentTenant}`,
queryKey: `BackupList-${currentTenant}`,
});

// API call to get existing backup configuration/schedule
Expand All @@ -61,7 +63,7 @@ const Page = () => {
showHidden: true,
Type: "New-CIPPBackup",
},
queryKey: `BackupTasks-${settings.currentTenant}`,
queryKey: `BackupTasks-${currentTenant}`,
});

// Use the actual backup files as the backup data
Expand Down Expand Up @@ -380,7 +382,10 @@ const Page = () => {
confirmText:
"Are you sure you want to remove this backup schedule? This will stop automatic backups but won't delete existing backup files.",
}}
relatedQueryKeys={[`BackupTasks-${settings.currentTenant}`, `BackupList-${settings.currentTenant}`]}
relatedQueryKeys={[
`BackupTasks-${settings.currentTenant}`,
`BackupList-${settings.currentTenant}`,
]}
onSuccess={() => {
// Refresh both queries when a backup schedule is removed
setTimeout(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/tenant/manage/drift.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const ManageDriftPage = () => {
const router = useRouter();
const { templateId } = router.query;
const userSettingsDefaults = useSettings();
const tenantFilter = userSettingsDefaults.currentTenant || "";
// Prioritize URL query parameter, then fall back to settings
const tenantFilter = router.query.tenantFilter || userSettingsDefaults.currentTenant || "";
const [anchorEl, setAnchorEl] = useState({});
const [bulkActionsAnchorEl, setBulkActionsAnchorEl] = useState(null);
const createDialog = useDialog();
Expand Down
3 changes: 2 additions & 1 deletion src/pages/tenant/manage/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const Page = () => {
const router = useRouter();
const { templateId } = router.query;
const settings = useSettings();
const currentTenant = settings.currentTenant;
// Prioritize URL query parameter, then fall back to settings
const currentTenant = router.query.tenantFilter || settings.currentTenant;

const formControl = useForm({
mode: "onChange",
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tenant/manage/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const Page = () => {
const router = useRouter();
const { templateId } = router.query;
const [daysToLoad, setDaysToLoad] = useState(5);
const tenant = useSettings().currentTenant;
const userSettings = useSettings();
// Prioritize URL query parameter, then fall back to settings
const tenant = router.query.tenantFilter || userSettings.currentTenant;
const [expandedMessages, setExpandedMessages] = useState(new Set());

// Toggle message expansion
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tenant/manage/recover-policies.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const RecoverPoliciesPage = () => {
const router = useRouter();
const { templateId } = router.query;
const [selectedPolicies, setSelectedPolicies] = useState([]);
const currentTenant = useSettings().currentTenant;
const userSettings = useSettings();
// Prioritize URL query parameter, then fall back to settings
const currentTenant = router.query.tenantFilter || userSettings.currentTenant;

const formControl = useForm({ mode: "onChange" });

Expand Down