Skip to content

Commit

Permalink
Boost: Remove logic to reset popup when score changes (#35219)
Browse files Browse the repository at this point in the history
* Remove logic to reset popup when score changes

This is faulty and causes more bugs than it fixes.

* add changelog
  • Loading branch information
dilirity authored Jan 24, 2024
1 parent 10a285f commit 52e1876
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { animated, useSpring } from '@react-spring/web';
import CloseButton from '$features/ui/close-button/close-button';
import styles from './pop-out.module.scss';
import { __ } from '@wordpress/i18n';
import { ReactNode, useEffect, useState } from 'react';
import { ReactNode, useState } from 'react';
import { Button } from '@wordpress/components';
import { useDismissibleAlertState } from '$features/performance-history/lib/hooks';
import { getRedirectUrl } from '@automattic/jetpack-components';
Expand Down Expand Up @@ -64,11 +64,6 @@ function PopOut( { scoreChange }: Props ) {
*/
const message = scoreChange && scoreChange < 0 ? slowerMessage : fasterMessage;

/*
* Track the last message shown so we can detect when it changes.
*/
const [ lastMessage, setLastMessage ] = useState< ScoreChangeMessage | null >( null );

/*
* Use datasync to track which score alerts have been dismissed.
* Dismissed means that the user asked to never show us this alert again.
Expand All @@ -80,16 +75,6 @@ function PopOut( { scoreChange }: Props ) {
*/
const [ isClosed, setClose ] = useState( false );

/*
* If the message has changed, reset the close state.
*/
useEffect( () => {
if ( message.id !== lastMessage?.id ) {
setLastMessage( message );
setClose( false );
}
}, [ message, lastMessage ] );

const hideAlert = () => setClose( true );

const animationStyles = useSpring( {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Revert speed score popout not showing "fix".


0 comments on commit 52e1876

Please sign in to comment.