You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix [share-modal]: preserve visibility-change error text - #1907
When changing visibility failed in ShareModal, users only saw "Failed to update visibility." and never the reason.
The host returns { error: "reason" }, but notifyVisibilityChange read res?.error?.error. Since res.error is already a string, that was always undefined.
What I changed
notifyVisibilityChange now reads res?.error directly (it still works if the error comes as an object)
Changed !res.error to !res?.error so an undefined response doesn't crash
Replaced the any types with proper ones
Test added
In ShareModalWireContract.test.tsx: when handleUpdateVisibility returns { error: 'visibility rejected' }, the notification now shows "Failed to update visibility. visibility rejected".
Visibility update failures now display an error notification, including the reason when provided. Notifications handle both plain-text and structured error details, use a general message when no details are available, and report a failure if no response is received. This makes failure messages clearer across different response formats.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
No actionable comments were generated in the recent review.
Walkthrough
ShareModal now handles visibility-update failures with string or nested error details and uses a generic message when details are absent. Parameterized tests check failure notifications for string, nested-object, and empty error details.
Changes: Visibility update error handling
Layer / File(s)
Summary
Normalize and test visibility errors src/custom/ShareModal/ShareModal.tsx, src/__testing__/ShareModalWireContract.test.tsx
The notification handler accepts an optional typed response, extracts string or nested error details, and uses a generic message when details are absent. Tests check notification messages and the error event type.
layer5io/sistent#1807: Addresses the same visibility-error message behavior and adds related component tests.
Suggested reviewers:aabidsofi19
Merge Risk: Minimal · up to 36e19
This change makes the visibility-update failure notification include the host's error text. The change is small and tested, and no merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: ShareModal's visibility-change failure notification now keeps the host's error text instead of dropping it. It matches the raw summary, which describes reading the str…
Linked Issues check
[#1789] The issue requires the host reason to appear in the visibility-change failure notification when handleUpdateVisibility resolves to { error: string }. At head 36e195a, notifyVisibilityChange in…
Out of Scope Changes check
The whole-PR diff against the merge base changes two files. src/custom/ShareModal/ShareModal.tsx changes only notifyVisibilityChange: parameter types (replacing any and removing the no-explicit-any es…
Full details: Title check
Explanation
The title names the main change: ShareModal's visibility-change failure notification now keeps the host's error text instead of dropping it. It matches the raw summary, which describes reading the string error directly and preserving nested-object errors. The title's 'fix [share-modal]:' prefix is a bracketed scope tag, which is a minor style point and does not make the title unrelated.
Full details: Linked Issues check
Explanation
[#1789] The issue requires the host reason to appear in the visibility-change failure notification when handleUpdateVisibility resolves to { error: string }. At head 36e195a, notifyVisibilityChange in src/custom/ShareModal/ShareModal.tsx computes errorDetail as res?.error when it is a string. It falls back to res?.error?.error only for the object form. The message is built as Failed to update visibility. ${errorDetail} when errorDetail is non-empty. The double .error lookup on a string, which caused the defect, is removed. The success check uses !res?.error, so an undefined response no longer throws. The new it.each cases in src/testing/ShareModalWireContract.test.tsx cover { error: 'visibility rejected' } (the issue's acceptance example), a nested object error, and an empty object error. They assert the expected message and event_type 'error'. The revoke path is not changed, which matches the issue's statement that it is already correct. The change since the previous review (the parameterized tests and the bare-message fallback for empty detail) is consistent with the issue. No unmet coding requirement was found.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes two files. src/custom/ShareModal/ShareModal.tsx changes only notifyVisibilityChange: parameter types (replacing any and removing the no-explicit-any eslint-disable), error-detail extraction, the empty-detail fallback message, and the !res?.error guard. These changes implement the fix for #1789 and the typing cleanup stated in the PR description. src/testing/ShareModalWireContract.test.tsx adds parameterized tests for the same notification path. The tests support the fix and do not cover unrelated behavior. No unrelated change was found.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 33b3f560-d271-47d7-86ab-282625e52203
Commits
Reviewing files that changed from the base of the PR and between 88ce058 and 36e195a.
Files selected for processing: 2
src/__testing__/ShareModalWireContract.test.tsx
src/custom/ShareModal/ShareModal.tsx
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Nice catch on #1789, this is a focused fix for a genuinely confusing failure mode: users now see the reason a visibility change failed instead of a bare failure message. The string-or-object handling in notifyVisibilityChange matches the host contract (handleUpdateVisibility returns { error: string }), and the new test pins the exact notification text for the string-error case. Dropping the any types and the eslint-disable is a nice cleanup too. Checks are green (DCO, triage, CodeRabbit), and the test coverage fits the change.
One small polish: when the error detail ends up empty, the failure message reads "Failed to update visibility. " with a trailing space. I left a one-click suggestion that only appends the detail when there is one. The object-shaped fallback path has no test of its own yet, so if that shape is still reachable, a second case mirroring the new one would pin it down.
AbhiramDhanvi
changed the title
fix(share-modal): preserve visibility-change error text
fix [share-modal]: preserve visibility-change error text
Nov 29, 2026
Good work! You might like to present your work in the upcoming, weekly Meshery development meeting (meshery.io/calendar). If so, I encourage you to add this item in the meeting agenda (meet.meshery.io/dev-minutes), attend, present, and receive feedback.
@AbhiramDhanvi Hey, I noticed your PR also addresses #1789, which is assigned to me. I already have PR #1807 open with the fix and regression tests, awaiting maintainer review. Could we coordinate to avoid duplicating work? Happy to compare our approaches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notes for Reviewers
This PR fixes #1789
What was wrong
When changing visibility failed in ShareModal, users only saw "Failed to update visibility." and never the reason.
The host returns { error: "reason" }, but notifyVisibilityChange read res?.error?.error. Since res.error is already a string, that was always undefined.
What I changed
anytypes with proper onesTest added
In ShareModalWireContract.test.tsx: when handleUpdateVisibility returns { error: 'visibility rejected' }, the notification now shows "Failed to update visibility. visibility rejected".
Lint, build and all tests pass locally.
Signed commits
Summary by CodeRabbit