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

Implement relatedLogEntries refresh button + spinner #703

Merged
merged 4 commits into from
Jul 7, 2024

Conversation

andrii-solokh
Copy link
Contributor

@andrii-solokh andrii-solokh commented Jun 23, 2024

Motivation
Working on new automation on a client project, I was generating logs in apex and attaching them to records. Each time I need to refresh the whole page, it was a bit annoying, so I thought it would be better to have a button for refresh or to auto refresh when new log created for currently open record.

Solution

  • I'm using 'Change Data Capture' events to track as new Log Entry records arrived, then refreshing Lighting Data Service results. Initially implemented 'RefreshView API', so after record update lwc should reload related log entries, but log were created with delay 1-2 seconds and they were not present in save refresh, only on second refresh, so I decided to use CDC.

Changes

  • Added spinner to let a user know - component is loading.
  • Added refresh button

Demo
Changing account name generates log on record.

demo.mov

@jongpie
Copy link
Owner

jongpie commented Jun 24, 2024

Hi @andrii-solokh - I definitely like the idea of having a refresh button on the component, but I think using CDC is going to cause too many other problems:

  • CDC has a limit of only 5 objects per org - so orgs that already have 5 objects enabled in CDC won't be able to install Nebula Logger (if Nebula Logger included a dependency on CDC)
  • Using the empApi has already caused problems in orgs - it counts towards a daily subscriber limit, which can cause a lot of issues in orgs that rely on pub/sub for external systems

So I think the CDC-related changes needed to be removed, it should just be a simple refresh button (that a user would manually click to refresh). Let me know if that makes sense/if you have any questions.

@andrii-solokh-mnfd
Copy link

Hi, @jongpie. Thank you for response, I can't find docs telling 5 objects are the limit, only number of concurrent subscribes.

But, okay i will remove CDC part.

@jongpie
Copy link
Owner

jongpie commented Jun 24, 2024

Hi @andrii-solokh - apologies, I meant to include a source for the 5 object limit. It's documented here on the page 'Default Change Event Allocations'

image

You can also test out the limit in a scratch org/sandbox - if you try to add more than 5 objects to CDC, you'll get this error:

image

@andrii-solokh
Copy link
Contributor Author

andrii-solokh commented Jun 25, 2024

@jongpie, thank you for the explanation, it looks like I should be more careful with using CDC and events in general.

Removed CDC part.

@jongpie jongpie changed the title Implemet relatedLogEntries auto refresh based on CDC events + spinner + refresh button Implement relatedLogEntries refresh button + spinner Jul 7, 2024
@jongpie jongpie added Type: Enhancement New feature or request Layer: Log Management Items related to the custom objects & Logger Console app Feature: Related Log Entries LWC Items related to the relatedLogEntries LWC labels Jul 7, 2024
Copy link
Owner

@jongpie jongpie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrii-solokh thanks so much for working on this, and for removing the CDC-related changes. I think what you built using CDC was very cool (and a great use case for CDC), but since Salesforce's platform limitations for it are so low, it's hard to rely on it sometimes.

Your changes look great - I've added a few extra commits to create the new package version, and I'll be releasing this today as v4.13.12.

@jongpie jongpie merged commit 88c630b into jongpie:main Jul 7, 2024
7 of 8 checks passed
@jongpie
Copy link
Owner

jongpie commented Jul 7, 2024

@andrii-solokh this now has been officially released as v4.13.12! 🥳

Thanks again for taking the time to work on this, I really appreciate the help!

@andrii-solokh
Copy link
Contributor Author

@jongpie it was tiny one, I hope to be more helpful in future 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Related Log Entries LWC Items related to the relatedLogEntries LWC Layer: Log Management Items related to the custom objects & Logger Console app Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants