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

[Flight] Set Current Owner / Task When Calling console.error or invoking onError/onPostpone #30206

Merged
merged 3 commits into from
Jul 4, 2024

Commits on Jul 4, 2024

  1. Track the current owner/stack/task on the task

    This tracks it for attribution when serializing child properties.
    
    Unfortunately, because we don't track the stack we never pop it so it'll
    keep tracking for serializing sibling properties. We rely on "children"
    typically being the last property in the common case anyway.
    It also doesn't affect client errors - only attribution on the RSC server
    itself.
    sebmarkbage committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    6e5b82e View commit details
    Browse the repository at this point in the history
  2. Run our own console.error in the context of the parent component

    It's annoying to have to remember to do this.
    
    We could always wrap the whole rendering in such as context but it would
    add more overhead since this rarely actually happens. It might make sense
    to track the whole current task instead to lower the overhead. That's
    what we do in Fizz.
    
    We'd still have to remember to restore the debug task though although Fizz
    doesn't do that neither.
    
    Also wrap onError and onPostpone with this context.
    sebmarkbage committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    af74df2 View commit details
    Browse the repository at this point in the history
  3. Only clear requestStorage if we're in onError/onPostpone

    We only clear these to avoid replaying logs from onError on the client.
    
    This doesn't make a difference because we're not clearing currentRequest
    for console.error but it should line up.
    sebmarkbage committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    e2e328c View commit details
    Browse the repository at this point in the history