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
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "10.10.3",
"version": "11.0.0",
"author": "CIPP Contributors",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down Expand Up @@ -65,7 +65,7 @@
"@tiptap/starter-kit": "^3.31.3",
"@vvo/tzdb": "^6.198.0",
"apexcharts": "7.1.0",
"axios": "1.18.1",
"axios": "1.20.0",
"date-fns": "4.4.0",
"diff": "^9.0.0",
"dompurify": "^3.4.12",
Expand All @@ -89,11 +89,11 @@
"numeral": "2.0.6",
"prop-types": "15.8.1",
"punycode": "^2.3.1",
"react": "19.2.8",
"react": "19.3.0",
"react-apexcharts": "2.1.1",
"react-beautiful-dnd": "13.1.1",
"react-dom": "19.2.8",
"react-dropzone": "20.0.0",
"react-dom": "19.3.0",
"react-dropzone": "20.1.2",
"react-error-boundary": "^6.1.2",
"react-hook-form": "^7.76.1",
"react-html-parser": "^2.0.2",
Expand All @@ -107,7 +107,7 @@
"react-syntax-highlighter": "^16.1.0",
"react-time-ago": "^7.3.3",
"react-virtuoso": "^4.18.7",
"recharts": "^3.8.1",
"recharts": "^3.10.1",
"redux": "5.0.1",
"redux-persist": "^6.0.0",
"rehype-raw": "^7.0.0",
Expand All @@ -124,27 +124,27 @@
"devDependencies": {
"@storybook/addon-a11y": "10.3.5",
"@storybook/addon-docs": "10.5.10",
"@storybook/addon-themes": "10.3.5",
"@storybook/addon-themes": "10.5.10",
"@storybook/addon-vitest": "10.3.5",
"@storybook/react-vite": "10.3.5",
"@svgr/webpack": "8.1.0",
"@testing-library/dom": "10.4.1",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/react": "16.3.2",
"@testing-library/user-event": "14.6.1",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.5",
"@testing-library/user-event": "14.6.7",
"@types/react": "19.3.0",
"@types/react-dom": "19.3.0",
"@vitest/browser-playwright": "4.1.11",
"@vitest/coverage-v8": "4.1.11",
"eslint": "^9.39.4",
"eslint-config-next": "^16.3.4",
"eslint-config-next": "^16.3.5",
"eslint-config-prettier": "^10.1.8",
"jsdom": "29.0.1",
"msw": "2.15.0",
"msw-storybook-addon": "3.0.0",
"msw-storybook-addon": "3.0.3",
"playwright": "1.63.0",
"prettier": "^3.9.6",
"storybook": "10.5.10",
"storybook": "10.6.0",
"typescript": "5.9.3",
"vite": "8.2.2",
"vitest": "4.1.11"
Expand Down
4 changes: 2 additions & 2 deletions public/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "10.10.3"
}
"version": "11.0.0"
}
33 changes: 32 additions & 1 deletion src/api/ApiCall.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ const getRetryAfterMs = (error) => {
const retryDelayWithRetryAfter = (failureCount, error) =>
getRetryAfterMs(error) ?? Math.min(1000 * 2 ** failureCount, 30000);

// A request the user cancelled (navigated away / hit Cancel) aborts the axios signal and surfaces as
// a CanceledError. That is expected, not a failure: never retry it and never raise an error toast.
const isCanceledError = (error) =>
error?.code === "ERR_CANCELED" || error?.name === "CanceledError";

export function ApiGetCall(props) {
const {
url,
Expand All @@ -50,6 +55,7 @@ export function ApiGetCall(props) {
const MAX_RETRIES = retry;
const HTTP_STATUS_TO_NOT_RETRY = [302, 401, 403, 404, 500];
const retryFn = (failureCount, error) => {
if (isCanceledError(error)) return false;
let returnRetry = true;
if (failureCount >= MAX_RETRIES) {
returnRetry = false;
Expand Down Expand Up @@ -191,7 +197,31 @@ export function ApiPostCall({ relatedQueryKeys, onResult }) {

const mutation = useMutation({
mutationFn: async (props) => {
const { url, data, bulkRequest } = props;
const { url, data, bulkRequest, followUps } = props;
if (followUps?.length) {
// A failed primary request throws as usual and nothing else is sent. Once it has
// succeeded, a failed follow-up is reported next to it rather than raised, so the
// primary's results are never hidden behind a follow-up error.
const primary = await axios.post(url, data, { headers: await buildVersionedHeaders() });
if (onResult) {
onResult(primary.data);
}
const results = [primary.data];
for (const followUp of followUps) {
try {
const response = await axios.post(followUp.url, followUp.data, {
headers: await buildVersionedHeaders(),
});
results.push(response.data);
} catch (error) {
results.push({
Results:
error.response?.data?.Results ?? `Failed ${followUp.url}: ${error.message}`,
});
}
}
return results;
}
if (bulkRequest && Array.isArray(data)) {
const results = [];
for (let i = 0; i < data.length; i++) {
Expand Down Expand Up @@ -278,6 +308,7 @@ export function ApiGetCallWithPagination({
const HTTP_STATUS_TO_NOT_RETRY = [302, 401, 403, 404, 500];

const retryFn = (failureCount, error) => {
if (isCanceledError(error)) return false;
let returnRetry = true;
if (failureCount >= MAX_RETRIES) {
returnRetry = false;
Expand Down
Loading
Loading