Skip to content

Commit 780d429

Browse files
committed
Bug 2011449 - Part 1: Make it so that newtab messages don't reappear on next load when dismissed. r=home-newtab-reviewers,nbarrett
This was due to a bug in how "data: false" was being interpreted (a false value for `data` on an action causes it to not actually be dispatched via the Redux store!) Differential Revision: https://phabricator.services.mozilla.com/D280828
1 parent 4719fec commit 780d429

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

browser/extensions/newtab/common/Reducers.sys.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ function Messages(prevState = INITIAL_STATE.Messages, action) {
596596
portID: action.data.portID || "",
597597
};
598598
case at.MESSAGE_TOGGLE_VISIBILITY:
599-
return { ...prevState, isVisible: action.data };
599+
return { ...prevState, isVisible: action.data.isVisible };
600600
default:
601601
return prevState;
602602
}

browser/extensions/newtab/data/content/activity-stream.bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6944,7 +6944,7 @@ function Messages(prevState = INITIAL_STATE.Messages, action) {
69446944
portID: action.data.portID || "",
69456945
};
69466946
case actionTypes.MESSAGE_TOGGLE_VISIBILITY:
6947-
return { ...prevState, isVisible: action.data };
6947+
return { ...prevState, isVisible: action.data.isVisible };
69486948
default:
69496949
return prevState;
69506950
}

browser/extensions/newtab/lib/NewTabMessaging.sys.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export class NewTabMessaging {
8080
this.store.dispatch(
8181
ac.AlsoToPreloaded({
8282
type: at.MESSAGE_TOGGLE_VISIBILITY,
83-
data: true,
83+
data: {
84+
isVisible: true,
85+
},
8486
})
8587
);
8688
}
@@ -159,6 +161,14 @@ export class NewTabMessaging {
159161
break;
160162
case at.MESSAGE_DISMISS:
161163
this.sendTelemetry("DISMISS", action.data.message);
164+
this.store.dispatch(
165+
ac.AlsoToPreloaded({
166+
type: at.MESSAGE_TOGGLE_VISIBILITY,
167+
data: {
168+
isVisible: false,
169+
},
170+
})
171+
);
162172
break;
163173
case at.MESSAGE_CLICK:
164174
this.sendTelemetry("CLICK", action.data.message, action.data.source);

0 commit comments

Comments
 (0)