-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix dismissed annoucement banner ignored when switching sites #3057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Summary of the deployments: Version 1 (production)
Version 2 (experimental)
Test content |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
8ad39b7
to
c8f2a6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where a dismissed announcement banner would reappear during client-side navigation by reapplying the dismissed state using a useEffect hook.
- Added a useEffect hook to reapply the dismissed state on route changes
- Updated the AnnouncementDismissedScript.tsx file to include the new behavior
Comments suppressed due to low confidence (1)
packages/gitbook/src/components/Announcement/AnnouncementDismissedScript.tsx:3
- [nitpick] Consider importing useEffect directly (e.g., 'import { useEffect } from "react";') to clarify the dependency usage and potentially reduce bundle size.
import * as React from 'react';
720f936
to
4aad1fc
Compare
Fixes an issue in v2 where the announcement banner would reappear during client-side navigation between routes despite being previously dismissed. The fix complements the existing page-load script with useEffect that reapplies the banner's dismissed state after next navigation updates the DOM.
before
CleanShot.2025-03-28.at.08.34.26.mp4
after
CleanShot.2025-03-28.at.08.02.31.mp4