Open kjozwiak opened 2 years ago
I feel like since we do a "debounced" save with a timeout, it's possible to close the promo card and quickly exit the browser before that state change is persisted in localStorage. It feels like this is a fundamental flaw with this approach, but perhaps we can perform a save when the component unmounts (assuming that doesn't already happen and that it would get called on Android when "swiping up" to close the browser). Would you have any advice here @zenparsing?
@emerick If the debouncing is the source of the problem, then a simple fix might be to override the debouncing for certain action types. For example, in the mergeReducers
function, you might be able to do something along the lines of:
if (state !== startingState) {
if (action.type === types.DISMISS_PROMO_PROMPT) {
storage.save(state)
} else {
storage.debouncedSave(state)
}
}
I'm not quite sure whether the "componentWillUnmount" approach will work or not - does it get called from window.onunload
and does it get called when the app is closed, and is it easy to grab the state from outside of the Redux flow?
Removing the release/blocking
label. We should be fine if this isn't fixed in 1.37.x
. To reproduce the above issue, the user basically needs to restart Brave right after closing the promo card. I don't think most users will be running into the above issue.
Description
Seems intermittent but there's cases where the
bitFlyer
promo code re-appears even though the user has tapped/clicked onX
orDon't show me again
.Steps to reproduce
Prerequisite: ensure that the device locale is set as
Japan
1.38.32 Chromium: 99.0.4844.51
brave://rewards
and notice the promo card being available/visibleX
orDon't show again
and close the browser right afterActual result
Example of the issue occurring --> https://youtu.be/FDkg1yCUgC8
Expected result
When the user taps/presses on either
X
or theDon't show again
buttons/text, it shouldn't re-display the banner in any case.Issue reproduces how often
Seems intermittent but I managed to reproduce it 100% using the STR/Cases.
Version/Channel Information:
N/A
(currently in1.38.x
&1.37.x
)Yes
once https://github.com/brave/brave-core/pull/12414 is upliftedYes
Device details
ARM
Pixel 6
Android 12
Brave version
Website problems only
N/A
N/A
N/A
Additional information
CCing @Uni-verse @srirambv @emerick @Miyayes