Skip to content

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Mar 14, 2023

Description:

When a report or an UI widget directly queries the API using a segment, it can currently happen that an UnprocessedSegmentException is thrown in the API if no usable archive can be found.

This would currently be displayed directly in the UI, as the AjaxHelper by default shows every error as notification.
As our UI has an additional way to determine if reports have been processed or not, resulting in a separate notification, there is no benefit in throwing the UnprocessedSegmentException for API requests triggered by the UI.

I've therefor changed the AjaxHelper so a XMLHttpRequest header will be sent with all requests and added some code to not throw the UnprocessedSegmentException for such requests.
Requests triggered from the UI will instead now receive the normal report with 0 values.

fixes #20222

Review

@sgiehl sgiehl added this to the 4.14.0 milestone Mar 14, 2023
@sgiehl sgiehl added the Needs Review PRs that need a code review label Mar 14, 2023
Copy link
Contributor

@bx80 bx80 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with newly created segments that hadn't been archived yet, only one correct message is shown 👍

@bx80 bx80 merged commit ba96ac5 into 4.x-dev Mar 15, 2023
@bx80 bx80 deleted the m20222 branch March 15, 2023 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Development

Successfully merging this pull request may close these issues.

Creating a new segment that has some visits will show 2 notifications instead of 1
2 participants