Skip to content
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

Newsfeed unread badge is always shown after refresh #99191

Closed
afharo opened this issue May 4, 2021 · 3 comments · Fixed by #100357
Closed

Newsfeed unread badge is always shown after refresh #99191

afharo opened this issue May 4, 2021 · 3 comments · Fixed by #100357
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Newsfeed Feature of the Newsfeed Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc triage_needed

Comments

@afharo
Copy link
Member

afharo commented May 4, 2021

Kibana version: master

Elasticsearch version: 8.0.0-SNAPSHOT

Server OS version: macOS 11.3

Browser version: Firefox 88.0

Browser OS version: macOS 11.3

Original install method (e.g. download page, yum, from source, etc.): from source

Describe the bug:

Every time Kibana is loaded, on the browser, the Newsfeed unread indicator is shown.

Steps to reproduce:

  1. Open Kibana
  2. Open the Newsfeed to set the feed as read (notice the red bubble is gone)
  3. Refresh the page
  4. Notice the red bubble is back

Expected behavior:

The red bubble should only show if new content is downloaded.

Screenshots (if relevant):
image

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context:

This might be the relevant piece of code to change:

function handleStatusChange(fetchResult: FetchResult | void | null) {
if (fetchResult) {
setShowBadge(fetchResult.hasNew);
}
setNewsFetchResult(fetchResult);
}
const subscription = apiFetchResult.subscribe((res) => handleStatusChange(res));

@afharo afharo added bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Newsfeed Feature of the Newsfeed labels May 4, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet
Copy link
Contributor

pgayvallet commented May 19, 2021

Found the root cause.

The local storage key we're using to store the already fetched item ids is regenerated at each reload

export class NewsfeedApiDriver {
private readonly id = uuid.v4();

this.hashSetStorageKey = `${NEWSFEED_HASH_SET_STORAGE_KEY}.${this.id}`;

This is causing the 'is new' logic to always returns false between reloads, and to also flood the local storage with old entries:

Screenshot 2021-05-19 at 10 20 16

Should be quite easy to address.

@pgayvallet pgayvallet self-assigned this May 19, 2021
@pgayvallet
Copy link
Contributor

pgayvallet commented May 19, 2021

After a closer look, it's slightly more complicated than that. ATM, when you open the newsfeed flyout, the information that the news was read is only used on the UI (removing the unread red pill in the header), and not propagated to the persistence. This was working-ish because of this issue. If we do fix the fact that reloading the page clears the unread state, we will also need to only flag new items as read when the user effectively opens the news flyout by clicking on the top nav button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Newsfeed Feature of the Newsfeed Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc triage_needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants