Skip to content

OLS-2925: Fix revert not clearing edit icon from attachment label#1861

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
kyoto:fix-attachment-revert-edit-icon
Apr 23, 2026
Merged

OLS-2925: Fix revert not clearing edit icon from attachment label#1861
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
kyoto:fix-attachment-revert-edit-icon

Conversation

@kyoto
Copy link
Copy Markdown
Member

@kyoto kyoto commented Apr 23, 2026

The onRevert handler passed undefined as originalValue to attachmentSet, which triggered the re-attach guard added in eb78619 and silently preserved the edited value in the attachments map. Pass the reverted value as originalValue instead so the guard is bypassed and isAttachmentChanged returns false.

Introduced by #1839

Made-with: Cursor

Summary by CodeRabbit

  • Bug Fixes

    • Fixed attachment revert functionality to properly maintain state consistency when reverting changes.
  • Tests

    • Added comprehensive unit test for attachment state synchronization during revert operations.

The onRevert handler passed undefined as originalValue to
attachmentSet, which triggered the re-attach guard added in eb78619
and silently preserved the edited value in the attachments map. Pass
the reverted value as originalValue instead so the guard is bypassed
and isAttachmentChanged returns false.

Made-with: Cursor
@kyoto kyoto added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 23, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 23, 2026

@kyoto: This pull request references OLS-2925 which is a valid jira issue.

Details

In response to this:

The onRevert handler passed undefined as originalValue to attachmentSet, which triggered the re-attach guard added in eb78619 and silently preserved the edited value in the attachments map. Pass the reverted value as originalValue instead so the guard is bypassed and isAttachmentChanged returns false.

Introduced by #1839

Made-with: Cursor

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: deb01cbb-cbe0-4f89-86d1-facc652db07e

📥 Commits

Reviewing files that changed from the base of the PR and between 3a482cd and ff55096.

📒 Files selected for processing (2)
  • src/components/AttachmentModal.tsx
  • unit-tests/redux-reducers.test.ts

📝 Walkthrough

Walkthrough

A single-line modification updates the onRevert handler to pass the reverted value as originalValue instead of undefined when dispatching attachmentSet. A corresponding unit test validates this reducer behavior.

Changes

Cohort / File(s) Summary
Attachment Revert Logic
src/components/AttachmentModal.tsx
Modified onRevert handler to dispatch attachmentSet with originalValue set to the reverted value instead of undefined.
Reducer Validation
unit-tests/redux-reducers.test.ts
Added unit test for AttachmentSet reducer to verify that originalValue correctly updates when set equal to value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A tiny change, but oh so fine,
The revert now holds the line,
Original value, preserved with care,
State and truth both square!
Tests confirm our logic's right,

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the specific fix being implemented: preventing the edit icon from remaining on the attachment label after a revert action. It directly relates to the core change where the onRevert handler now passes the reverted value as originalValue to properly clear the edited state.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from syedriko and xrajesh April 23, 2026 07:55
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented Apr 23, 2026

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

@openshift-cherrypick-robot
Copy link
Copy Markdown

@kyoto: once the present PR merges, I will cherry-pick it on top of pattern-fly-5, release-4.19 in new PRs and assign them to you.

Details

In response to this:

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jgbernalp
Copy link
Copy Markdown

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit b0a6601 into openshift:main Apr 23, 2026
5 checks passed
@openshift-cherrypick-robot
Copy link
Copy Markdown

@kyoto: new pull request created: #1862

Details

In response to this:

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@kyoto: new pull request created: #1863

Details

In response to this:

/cherry-pick release-4.19
/cherry-pick pattern-fly-5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants