-
Notifications
You must be signed in to change notification settings - Fork 129
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
Context Clearing #1379
base: main
Are you sure you want to change the base?
Context Clearing #1379
Conversation
✅ Deploy Preview for fdc3 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -36,6 +36,7 @@ interface Channel { | |||
broadcast(context: Context): Promise<void>; | |||
getCurrentContext(contextType?: string): Promise<Context|null>; | |||
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>; | |||
clearContext(contextType?: string): Promise<void>; |
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.
I'm wondering if we should require an explicit null argument (contextType: string | null
) to clear all types - which would match addContectListener
or stick with this (matching getCurrentContext
). Either works of course.
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.
To me it makes sense to keep it closer to getCurrentContext, because they seem most related to me, but happy to hear any thoughts/suggestions.
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.
There is a historical reason for addContextListener
having an explicit null argument, the contextType
argument was originally optional so the handler
argument could be either first or second (when a type was specified). This was NOT good in practice so we moved to an explicit null
argument and deprecated the single argument override:
https://fdc3.finos.org/docs/2.0/api/ref/DesktopAgent#addcontextlistener-deprecated
We don't have that problem here, so I agree its fine as is (matching getCurrentContext
).
@@ -57,6 +58,7 @@ interface IChannel: IIntentResult | |||
Task Broadcast(IContext context); | |||
Task<IContext?> GetCurrentContext(string? contextType); | |||
Task<IListener> AddContextListener<T>(string? contextType, ContextHandler<T> handler) where T : IContext; | |||
Task ClearContext(string? contextType); |
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.
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.
Many thanks for taking this on @kemerava.
Could you add an entry to the CHANGLOG.md file please.
I think we should keep this open until after fdc3 for the web (#1191) is merged, when we will need to add schemas for a request and response message. The same may be needed in the bridging (the fdc3.nothing
ewill propagate through normal broadcast messages, but I think this will need a specific message to indicate it happened through the clearContextAPI call).
Co-authored-by: Kris West <kris.west@interop.io>
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.
LGTM - although we could do with an example of listening for cleared context somewhere.
Holding approval until after fdc3-for-web is merged as we'll then need to add schemas to support it there. Bridging schemas are also needed, those should be added before this is merged.
Many thanks for the contribution @kemerava, much appreciated.
Closes #1197
Adding context cleaning
@michael-bowen-sc