WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@AyushCoder9
Copy link
Contributor

introduce getContextIfAny, which returns the stored context or undefined without throwing
make the existing getContext delegate to the softer helper so behavior stays unchanged when no context exists
expand the context-storage tests to cover both success and missing-context scenarios for the new helper

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.49%. Comparing base (342ff3b) to head (15cde5d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4539      +/-   ##
==========================================
- Coverage   91.52%   91.49%   -0.03%     
==========================================
  Files         172      172              
  Lines       11221    11233      +12     
  Branches     3255     3258       +3     
==========================================
+ Hits        10270    10278       +8     
- Misses        950      954       +4     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yusukebe yusukebe changed the title Add optional getContextIfAny helper to context-storage middleware feat(context-storage): Add optional getContextIfAny helper to context-storage middleware Nov 26, 2025
@yusukebe
Copy link
Member

This PR will resolve #4536.

@yusukebe
Copy link
Member

@AyushCoder9 Thank you for the PR!

Hi @elibarzilay! What do you think of this PR? I think good.

@elibarzilay
Copy link

@AyushCoder9 Thank you for the PR!

Hi @elibarzilay! What do you think of this PR? I think good.

LGTM either way -- I specifically avoided thinking too much about a good name, to leave it up to people who might know the codebase better :)

@AyushCoder9
Copy link
Contributor Author

@AyushCoder9 Thank you for the PR!

Hi @elibarzilay! What do you think of this PR? I think good.

LGTM either way -- I specifically avoided thinking too much about a good name, to leave it up to people who might know the codebase better :)

@elibarzilay are you merging this pr ? Tell me if I need to change something !!

@elibarzilay
Copy link

I'm just the person who made the feature request, I'm not a regular contributor...

(Also, I'm guessing that it would be good to get a blessing from @marceloverdijk since he wrote the code.)

@AyushCoder9
Copy link
Contributor Author

I'm just the person who made the feature request, I'm not a regular contributor...

(Also, I'm guessing that it would be good to get a blessing from @marceloverdijk since he wrote the code.)

@marceloverdijk check if this pr is good enough

@marceloverdijk
Copy link
Contributor

👍 I think it looks good (and a nice addition)

@AyushCoder9
Copy link
Contributor Author

👍 I think it looks good (and a nice addition)

glad to here that @marceloverdijk merge it if you liked it, would be an honour !!

@yusukebe
Copy link
Member

yusukebe commented Dec 3, 2025

Hi @AyushCoder9

Can you handle the comment #4539 (comment)?

If you don't react to it, we can't merge this.

@AyushCoder9
Copy link
Contributor Author

Hi @AyushCoder9

Can you handle the comment #4539 (comment)?

If you don't react to it, we can't merge this.

@yusukebe I've updated the PR to rename getContextIfAny to tryGetContext.

@yusukebe yusukebe changed the title feat(context-storage): Add optional getContextIfAny helper to context-storage middleware feat(context-storage): Add optional tryGetContext helper to context-storage middleware Dec 3, 2025
Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@yusukebe
Copy link
Member

yusukebe commented Dec 3, 2025

@AyushCoder9

Thank you!! We are planning to include this change in the next minor version. So, I'll merge this later!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants