Skip to content

Fix pulse beta toast message only on fresh render on feat/PRO-3749/pulse-beta-tag#417

Merged
RanaBug merged 1 commit intostagingfrom
feat/PRO-3749/pulse-beta-tag
Oct 1, 2025
Merged

Fix pulse beta toast message only on fresh render on feat/PRO-3749/pulse-beta-tag#417
RanaBug merged 1 commit intostagingfrom
feat/PRO-3749/pulse-beta-tag

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Oct 1, 2025

Description

  • Show pulse beta toast message only on fresh render

How Has This Been Tested?

  • Existing Unit tests and manual testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • New Features

    • Adds a dismissible “Welcome to Pulse (beta)” toast that appears when opening the Pulse app.
    • Toast displays above main content and can be closed at any time.
    • Ensures consistent toast behavior regardless of the initial screen.
  • Tests

    • Added automated tests verifying the toast appears on app open and is removed after closing.

@RanaBug RanaBug requested a review from IAmKio October 1, 2025 14:54
@RanaBug RanaBug self-assigned this Oct 1, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Moves PulseToast initialization and rendering from HomeScreen to AppWrapper. AppWrapper now shows the beta toast on mount and hides it on close. HomeScreen no longer references PulseToast. Tests added to verify toast visibility on open and dismissal behavior. No exported/public APIs changed.

Changes

Cohort / File(s) Summary
App wrapper toast integration
src/apps/pulse/components/App/AppWrapper.tsx
Adds local state to control PulseToast, shows it on mount via useEffect, renders PulseToast with onClose to hide it; wraps existing Search/HomeScreen rendering beneath the toast.
Home screen cleanup
src/apps/pulse/components/App/HomeScreen.tsx
Removes all PulseToast-related code: imports, state, effect, and rendering.
Tests for toast behavior
src/apps/pulse/components/App/tests/AppWrapper.test.tsx
Adds tests asserting the beta toast appears on app open and can be closed (including wait for exit animation).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Router as Router
  participant App as AppWrapper
  participant Toast as PulseToast

  Router->>App: Mount AppWrapper
  activate App
  App->>App: useEffect on mount sets showBetaToast = true
  App->>Toast: Render PulseToast (visible)
  deactivate App

  User->>Toast: Click Close
  Toast-->>App: onClose callback
  App->>App: set showBetaToast = false
  App-->>Toast: Unmount PulseToast (after animation)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • IAmKio

Poem

I thump with joy—new toasts arise,
A beta breeze beneath the skies.
From Home to App I hop with glee,
A close, a fade—so clean to see.
Ears up, I nibble code so neat,
Pulse pops in—then takes a seat. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title correctly identifies the core change of showing the Pulse beta toast only on fresh renders but includes extraneous branch and ticket information, making it overly verbose and less clear at a glance. Please simplify the title to focus on the change itself, for example “Show Pulse beta toast only on initial render,” and remove any branch or ticket identifiers.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed The PR description adheres to the repository template by providing a clear summary under Description, detailing test methods under How Has This Been Tested, including the Types of changes checklist, and leaving the optional Screenshots section in place, resulting in a structured and complete description.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/PRO-3749/pulse-beta-tag

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.

❤️ Share

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

@cloudflare-workers-and-pages
Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: f96776d
Status: ✅  Deploy successful!
Preview URL: https://65ab2db8.x-e62.pages.dev
Branch Preview URL: https://feat-pro-3749-pulse-beta-tag.x-e62.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/apps/pulse/components/App/tests/AppWrapper.test.tsx (1)

299-320: Prefer testing-library async utilities over manual setTimeout.

The test works but could be more robust and idiomatic. Consider using waitForElementToBeRemoved from @testing-library/react and userEvent for interactions instead of manual Promise/setTimeout and direct .click().

Apply this diff to improve the test:

+import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';

  it('allows closing the beta toast', async () => {
+   const user = userEvent.setup();
    renderWithProviders(
      <MemoryRouter initialEntries={['/']}>
        <AppWrapper />
      </MemoryRouter>
    );

    expect(screen.getByText('Welcome to Pulse (beta)')).toBeInTheDocument();

    // Close the toast
    const closeButton = screen.getByLabelText('Close');
-   closeButton.click();
+   await user.click(closeButton);

-   // Wait for the animation to complete (300ms delay + some buffer)
-   await new Promise((resolve) => {
-     setTimeout(resolve, 400);
-   });
-
-   expect(
-     screen.queryByText('Welcome to Pulse (beta)')
-   ).not.toBeInTheDocument();
+   // Wait for toast to be removed after animation
+   await waitForElementToBeRemoved(() => 
+     screen.queryByText('Welcome to Pulse (beta)')
+   );
  });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2acbe4 and f96776d.

📒 Files selected for processing (3)
  • src/apps/pulse/components/App/AppWrapper.tsx (4 hunks)
  • src/apps/pulse/components/App/HomeScreen.tsx (0 hunks)
  • src/apps/pulse/components/App/tests/AppWrapper.test.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/apps/pulse/components/App/HomeScreen.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/apps/pulse/components/App/tests/AppWrapper.test.tsx (1)
src/apps/pulse/components/App/AppWrapper.tsx (1)
  • AppWrapper (12-100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: unit-tests
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (5)
src/apps/pulse/components/App/tests/AppWrapper.test.tsx (1)

289-297: LGTM!

The test correctly verifies that the beta toast appears when the Pulse app opens. The implementation is straightforward and validates the core requirement.

src/apps/pulse/components/App/AppWrapper.tsx (4)

9-9: LGTM!

The import is correctly added and follows the project's import structure.


18-18: LGTM!

State initialization to false is appropriate, ensuring the toast only displays after the mount effect runs.


43-46: Verify intended "fresh render" behavior.

The PR title mentions "only on fresh render," but the implementation shows the toast on every component mount (due to the empty dependency array). If "fresh render" means the first-ever app launch (not just component mount), you'd need persistence (e.g., localStorage or sessionStorage) to track whether the user has already seen the toast.

Current behavior: Toast appears every time AppWrapper mounts (e.g., navigating away and back).

Intended behavior based on comment: "every time Pulse app opens" suggests current implementation is correct.

Please confirm if this matches your requirements.


69-99: LGTM!

The rendering logic correctly positions the PulseToast above both view paths. The onClose handler properly manages toast dismissal, and the fragment wrapper cleanly accommodates the additional UI element without disrupting existing logic.

@RanaBug RanaBug merged commit 43b9743 into staging Oct 1, 2025
6 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 14, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 4, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants