Skip to content

feat(uptime-json-path-assertion): Splitting path string to value, operator and operand#107512

Merged
Abdkhan14 merged 5 commits intomasterfrom
abdk/uptime-assertion-json-path
Feb 3, 2026
Merged

feat(uptime-json-path-assertion): Splitting path string to value, operator and operand#107512
Abdkhan14 merged 5 commits intomasterfrom
abdk/uptime-assertion-json-path

Conversation

@Abdkhan14
Copy link
Contributor

@Abdkhan14 Abdkhan14 commented Feb 3, 2026

Before:
Screenshot 2026-02-03 at 1 33 02 PM

After:
Screenshot 2026-02-03 at 1 32 28 PM

@Abdkhan14 Abdkhan14 requested a review from a team as a code owner February 3, 2026 16:54
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 3, 2026
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

if (nextValue) {
onChange(nextValue);
}
}, [isNumeric, onChange, operandValue, normalizedOp]);
Copy link
Contributor

Choose a reason for hiding this comment

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

useEffect runs on every render due to object dependency

Medium Severity

The normalizedOp variable is created fresh on every render via normalizeJsonPathOp(value), and then included in the useEffect dependency array at line 77. Since normalizedOp is always a new object reference, the effect runs on every render regardless of whether the actual values changed. This is inefficient and a common React anti-pattern. The fix is to memoize normalizedOp with useMemo(() => normalizeJsonPathOp(value), [value]) so it only changes when value actually changes.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't really care much about performance here, I think this is okay.

We do spam useMemo all over the codebase

@Abdkhan14 Abdkhan14 requested review from jaydgoss and klochek February 3, 2026 18:45
Copy link
Member

@jaydgoss jaydgoss left a comment

Choose a reason for hiding this comment

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

LGTM, I think it would be good to do some manual testing with existing monitors that have json assertions to make sure this is fully backwards compatible.

Copy link
Contributor

@klochek klochek left a comment

Choose a reason for hiding this comment

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

Path/operand stuff looks good to me

@Abdkhan14
Copy link
Contributor Author

LGTM, I think it would be good to do some manual testing with existing monitors that have json assertions to make sure this is fully backwards compatible.

@jaydgoss yeah just tested with this one, working as expected

@Abdkhan14 Abdkhan14 merged commit 34839a8 into master Feb 3, 2026
60 checks passed
@Abdkhan14 Abdkhan14 deleted the abdk/uptime-assertion-json-path branch February 3, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants