Skip to content

[INJIWEB-1802]Fixed the bug where the Coming soon toaster message was auto-dismissing.#478

Open
iamlokanath wants to merge 1 commit intoinji:developfrom
iamlokanath:injiweb-1802
Open

[INJIWEB-1802]Fixed the bug where the Coming soon toaster message was auto-dismissing.#478
iamlokanath wants to merge 1 commit intoinji:developfrom
iamlokanath:injiweb-1802

Conversation

@iamlokanath
Copy link

@iamlokanath iamlokanath commented Jan 6, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Toast notifications on the home page now require manual dismissal instead of automatically closing.

✏️ Tip: You can customize this high-level summary in your review settings.

… auto-dismissing.

Signed-off-by: Lkanath Panda <lokanthpanda128@gmai.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

Walkthrough

Toast notifications in HomePage are configured to disable automatic closure with autoClose: false, accompanied by formatting normalization across imports, destructuring, and JSX syntax. Test expectations are updated to verify the manual-close behavior.

Changes

Cohort / File(s) Summary
Toast Configuration & Testing
inji-web/src/pages/HomePage.tsx, inji-web/src/__tests__/pages/HomePage.test.tsx
Added autoClose: false to toast warnings to prevent automatic dismissal. Updated test scenarios and assertions to verify manual-close behavior instead of auto-disappearance. Normalized spacing in imports, destructuring, and JSX component tags.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A toast that lingers, never rushed away,
Manual hands now guide its stay.
Spaces aligned in neat formation,
Our HomePage wears fresh notation!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: fixing a bug where a toast message was auto-dismissing. The change summary confirms this is the primary focus, with modifications to add autoClose: false to the toast configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link

@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)
inji-web/src/pages/HomePage.tsx (1)

1-9: Minor formatting changes unrelated to the main fix.

These import and spacing normalizations are stylistic improvements but unrelated to the toast auto-dismiss bug. Consider keeping PRs focused on a single objective for easier review and cleaner git history.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4c7129 and 9950afc.

📒 Files selected for processing (2)
  • inji-web/src/__tests__/pages/HomePage.test.tsx
  • inji-web/src/pages/HomePage.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
inji-web/src/__tests__/pages/HomePage.test.tsx (1)
inji-web/src/utils/constants.ts (1)
  • LANDING_VISITED (65-65)
🔇 Additional comments (6)
inji-web/src/pages/HomePage.tsx (2)

65-67: JSX spacing normalization looks good.

The added spaces in self-closing tags improve consistency and readability.

Also applies to: 70-70, 74-74


57-58: Implementation correctly addresses manual dismissal requirements.

The autoClose: false configuration with react-toastify 10.0.5 properly disables automatic dismissal. Since no explicit closeButton: false option is set, the default close button is shown automatically, allowing users to easily dismiss the toast. The onClose callback properly manages the toast visibility state. No further changes needed.

inji-web/src/__tests__/pages/HomePage.test.tsx (4)

76-101: Test formatting improvements look good.

The reformatted sessionStorage tests maintain the same functionality with cleaner structure and proper spy usage.


110-135: Test properly verifies single toast creation with autoClose disabled.

The test correctly validates that:

  • Multiple rapid clicks only trigger one toast
  • The toast is configured with autoClose: false
  • The toastId is properly set

149-178: Excellent test coverage for non-auto-closing behavior.

This test effectively validates the core fix by:

  • Triggering the toast
  • Waiting 4 seconds (longer than typical auto-close duration)
  • Verifying the toast remains present
  • Confirming autoClose: false was passed to toast.warning

The 4-second wait on Line 172 provides strong evidence that auto-dismissal is truly disabled.


180-234: Test correctly validates toast can be re-shown after manual dismissal.

The test properly verifies that:

  • After a toast is manually closed (via onClose callback)
  • A subsequent click can trigger a new toast
  • The new toast also has autoClose: false

The use of fake timers and manual triggering of onClose accurately simulates the real-world flow.

@iamlokanath
Copy link
Author

INJIWEB-1802.mp4

Comment on lines +1 to +9
import React, { useEffect, useState } from "react";
import { HomeBanner } from "../components/Home/HomeBanner";
import { HomeFeatures } from "../components/Home/HomeFeatures";
import { HomeQuickTip } from "../components/Home/HomeQuickTip";
import { toast } from "react-toastify";
import { useTranslation } from "react-i18next";
import { useLocation } from 'react-router-dom';
import { LoginFailedModal } from '../components/Login/LoginFailedModal';
import { LANDING_VISITED } from "../utils/constants";
Copy link
Contributor

Choose a reason for hiding this comment

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

same applies here. let’s avoid whitespace or formatting-only changes

Comment on lines +80 to +100
const setItemSpy = jest.spyOn(window.sessionStorage.__proto__, 'setItem');
renderComponent();
expect(setItemSpy).toHaveBeenCalledWith(LANDING_VISITED, 'true');
});

test('logs a warning if sessionStorage.setItem fails', () => {
const setItemSpy = jest
.spyOn(window.sessionStorage.__proto__, 'setItem')
.mockImplementation(() => {
throw new Error('storage failed');
});
const setItemSpy = jest
.spyOn(window.sessionStorage.__proto__, 'setItem')
.mockImplementation(() => {
throw new Error('storage failed');
});

const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => { });

renderComponent();
renderComponent();

expect(setItemSpy).toHaveBeenCalledWith(LANDING_VISITED, 'true');
expect(warnSpy).toHaveBeenCalledWith(
'Unable to access sessionStorage',
expect.any(Error)
);
expect(setItemSpy).toHaveBeenCalledWith(LANDING_VISITED, 'true');
expect(warnSpy).toHaveBeenCalledWith(
'Unable to access sessionStorage',
expect.any(Error)
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could these formatting updates be avoided and the changes be kept focused on the behavior? It will help keep the diff clean and easier to review.

Copy link
Contributor

@Rudhhi-Shah-14 Rudhhi-Shah-14 left a comment

Choose a reason for hiding this comment

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

Please try to limit the changes in this PR to functional updates only.

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