-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Execution Context] Update on URL change #200785
base: main
Are you sure you want to change the base?
[Execution Context] Update on URL change #200785
Conversation
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
/ci |
💔 Build Failed
Failed CI StepsHistory
cc @afharo |
@afharo, thank for looking into it! Not sure I understand how this helps, I might be missing something here I thought that we already reported the correct Lines 103 to 104 in b628770
The problem with #195778 is that we don't report so, for example, in the |
You are correct! The URL is correctly updated there, but the However, when the URL changes, we don't update it.
That's a great point! My PR would only update the path on URL changes providing the full path ( I wonder if this is a good fallback, but it still requires the ReactRouter to override this when necessary. WDYT? |
Aha, so Lines 101 to 104 in b628770
is not called on every sent event? instead it is called only when |
Sorry, what do you mean with "always"? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. Forget previous questions, history.listen makes sense considering how the system is set up
// Track URL changes to make sure that we reflect the new path name | ||
this.subscription.add( | ||
history.listen((location) => { | ||
start.set({ url: location.pathname }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be that location.pathname
didn't change, right? Maybe worth calling only when has changed?
Summary
Resolves #195778
This PR attempts to fix #195778 and https://github.com/elastic/observability-dev/issues/3776 by calling
executionContext.set({ url })
whenever we identify the pathname has changed (using thehistory
module for that).Hopefully, this will remove the need of plugins explicitly calling the execution context to update the path when their internal
Router
applies any changes.Checklist
Identify risks
executionContext.set
instead ofexecutionContext.clear
. The difference is that any previous contextual information will be kept. When switching apps, we clear every previous context. However, when inside the same app, it didn't feel right to clear everything. Should it?