-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ref(hub): Convert Session
class to object and functions
#5054
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size-limit report 📦
|
Lms24
commented
May 9, 2022
AbhiPrasad
approved these changes
May 10, 2022
AbhiPrasad
approved these changes
May 11, 2022
Lms24
added a commit
that referenced
this pull request
May 11, 2022
fix after merging #5054 which left an unresolved conflict in Migration.MD that emerged while rebasing the PR onto the current 7.x branch.
AbhiPrasad
pushed a commit
that referenced
this pull request
May 30, 2022
convert the `Session` class to a more FP style `Session` object with additional functions that replace the methods of the class. API-wise, this makes the following changes: * `new Session(context)` => `makeSession(context)` * `session.update(context)` => `updateSession(session, context)` * `session.close(status)` => `closeSession(session, status)` `session.toJSON()` is left untouched because this method is called when the Session object is serialized to the JSON object that's sent to the Sentry servers. Additionally, this modify the session-related interfaces. Interface `Session` now describes the session object while the `SessionContext` interface is used to make modifications to the session by calling `updateSession`. Note that `updateSession` and `closeSession` mutate the session object that's passed in as a parameter. I originally wanted to return a new, mutated, object and leave the original one untouched instead of changing it. However this is unfortunately not possible (without bigger modifications) as `BaseClient` makes a modification to a session after it's already passed to `sendSession` to keep it from getting re-sent as a new session.
AbhiPrasad
pushed a commit
that referenced
this pull request
May 30, 2022
fix after merging #5054 which left an unresolved conflict in Migration.MD that emerged while rebasing the PR onto the current 7.x branch.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR converts the
Session
class to a more FP styleSession
object with additional functions that replace the methods of the class.API-wise, This PR makes the following changes:
new Session(context)
=>makeSession(context)
session.update(context)
=>updateSession(session, context)
session.close(status)
=>closeSession(session, status)
session.toJSON()
is left untouched because this method is called when the Session object is serialized to the JSON object that's sent to the Sentry servers.Additionally, this PR modifies the session-related interfaces. Interface
Session
now describes the session object while theSessionContext
interface is used to make modifications to the session by callingupdateSession
.Note that
updateSession
andcloseSession
mutate the session object that's passed in as a parameter. I originally wanted to return a new, mutated, object and leave the original one untouched instead of changing it. However this is unfortunately not possible (without bigger modifications) asBaseClient
makes a modification to a session after it's already passed tosendSession
to keep it from getting re-sent as a new session.ref: https://getsentry.atlassian.net/browse/WEB-815