🐛 Refreshed cancel button state after retention offer flow#26735
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe portal app version was bumped from 2.65.4 to 2.65.5. Four action functions now include a 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/portal/test/app.test.js (1)
105-118: Test validates the expected behavior, but the comment is slightly misleading.The comment on line 110 says "should clear any stale reloadOnPopupClose", but the test doesn't actually verify the clearing mechanism from
openPopup. It verifies that whenreloadOnPopupClose: falseis set and the popup closes, no reload occurs—which is still a valid and useful test case.Consider updating the test description or comment to more accurately reflect what's being tested.
📝 Suggested comment clarification
test('does not reload on subsequent popup close after reloadOnPopupClose was previously set', () => { const app = new App({siteUrl: 'http://example.com'}); window.location.reload = vi.fn(); - // Simulate opening a new popup - should clear any stale reloadOnPopupClose + // State after openPopup action sets reloadOnPopupClose to false app.state = {...app.state, showPopup: true, reloadOnPopupClose: false}; - // Close the popup without reloadOnPopupClose + // Close the popup - should not reload since flag is false app.state = {...app.state, showPopup: false}; app.componentDidUpdate({}, {showPopup: true}); expect(window.location.reload).not.toHaveBeenCalled(); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/portal/test/app.test.js` around lines 105 - 118, Update the test description/comment to accurately reflect its behavior: change wording that currently claims "should clear any stale reloadOnPopupClose" to indicate it verifies that when reloadOnPopupClose is explicitly false on the App instance (app.state.reloadOnPopupClose = false) and the popup closes (app.componentDidUpdate invoked with previous showPopup true), window.location.reload is not called. Reference the test(name), the App class, app.state.reloadOnPopupClose, and componentDidUpdate (or openPopup if you add a separate test for clearing) so readers know this test checks "no reload when reloadOnPopupClose is false" rather than verifying openPopup's clearing logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/portal/test/app.test.js`:
- Around line 105-118: Update the test description/comment to accurately reflect
its behavior: change wording that currently claims "should clear any stale
reloadOnPopupClose" to indicate it verifies that when reloadOnPopupClose is
explicitly false on the App instance (app.state.reloadOnPopupClose = false) and
the popup closes (app.componentDidUpdate invoked with previous showPopup true),
window.location.reload is not called. Reference the test(name), the App class,
app.state.reloadOnPopupClose, and componentDidUpdate (or openPopup if you add a
separate test for clearing) so readers know this test checks "no reload when
reloadOnPopupClose is false" rather than verifying openPopup's clearing logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d55db170-4f1e-4b6a-846d-a0a7150b8447
📒 Files selected for processing (5)
apps/portal/package.jsonapps/portal/src/actions.jsapps/portal/src/app.jsapps/portal/test/actions.test.tsapps/portal/test/app.test.js
ref https://linear.app/ghost/issue/BER-3417 When a member cancelled via the retention offer path (Portal popup), the theme page's cancel button didn't update because no page reload occurred. The `cancelSubscription` and `applyOffer` actions now return `reloadOnPopupClose: true`, and the App component reloads the page when the popup closes with that flag set. The flag is cleared on each `openPopup` to prevent stale reloads.
2062771 to
a591bf4
Compare
🤖 Velo CI Failure AnalysisClassification: 🔴 HARD FAIL
|
ref https://linear.app/ghost/issue/BER-3417
When a member cancelled via the retention offer path (Portal popup), the theme page's cancel button didn't update because no page reload occurred. The
cancelSubscriptionandapplyOfferactions now returnreloadOnPopupClose: true, and the App component reloads the page when the popup closes with that flag set. The flag is cleared on eachopenPopupto prevent stale reloads.