-
Notifications
You must be signed in to change notification settings - Fork 132
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 #1197
Comments
@hellosmithy Many thanks for the detailed write up. This was previously considered under issue #301, and has subsequently been raised as a question in a meeting at least once. Hence, I believe this is worth revisiting and I propose to do so at the May SWG meeting. |
I've updated the above proposal to reflect the discussion from the last WG |
Many thanks @hellosmithy! |
@hellosmithy one thing I would update in the write up:
They wouldn't receive a
From there this needs a PR to implement it that will touch:
I'd be most happy for you to take that on ;-) although we'll need your CLA in place to merge it. Ideally, it gets done before next months SWG meeting so we can get it adopted into the 2.2 scope. If the CLa is likeloy to get in the way of that timeline, let me know and I'll see if I can help get the PR done! |
I really like the idea of the
So one thing that isn't really clear then is:
Perhaps this would be better in a specific, new context type, say |
@robmoffat by 'the fdc3.nothing approach' do you mean manual broadcast of that triggering a clear? If so I think that very much optional and not something we need to do. However, if you mean the DA broadcasting fdc3.nothing to indicate that a clear has happened, then I do think we need a form of notification and fdc3.nothing works pretty well for it. Its got few other uses (raising intents without a context) that seem semantically compatible as its just supposed to represent a lack of context. |
@robmoffat @kriswest after a long wait for CLA and looking at this with fresh eyes I also wonder if the adding of a If we went down the explicit E.g. const allContextsListener = await channel.addContextListener(null, ...);
const timeRangeListener = await channel.addContextListener('fdc3.timeRange', ...);
await channel.clearContext('fdc3.timeRange'); What value do the two handlers for The In the case of But it might be strange to broadcast a I suppose another option might be to change the handler to something like: |
@hellosmithy these are excellent questions. Good analysis. |
Thanks @hellosmithy. I'm not sure there is a perfect or elegant answer here unfortunately. Re: type ContextHandler = (contextType: string, context: Context | null, metadata?: ContextMetadata) => void; You only need the With An alternative could be to notify apps of the cleared context via the new (including from @kemerava who has been considering this issue as well) |
Thanks @hellosmithy. I would probably vote for not introducing a breaking change here. I think having an event listener like @kriswest suggested can be helpful in this case. We can even introduce a new type like |
Thanks @kriswest @kemerava - I'm not too familiar yet with the semantics of the new |
Good point @hellosmithy. addEventListener would more naturally associate with the current user channel, unless it came with data in the event pointing tothe channel. This is quite disconnected from the Channel object and hence inelegant/unintuitive. Another approach to think about is the use of the optional ContextMetadata object passed to the ContextHandler See https://fdc3.finos.org/docs/api/ref/Types#contexthandler. Which brings me back to the use of fdc3.nothing to indicate a cleared context. That at least offers an opt-in (you need to be listening to all types or specifically the fdc3.nothing type to received the clear message) and is non-breaking (we're only delivering context messages and not changing any API types). The only inelegant part of that proposal is that someone could manually broadcast an fdc3.nothing. To handle that we could require that DA either reject the broadcast of fdc3.nothing or interpret it as a clearContext call... |
Enhancement Request
NOTE: Edited to reflect discussion from Standard WG Meeting - May 23rd, 2024 #1215
Use Case:
Enable explicit clearing of individual contexts including within multi-context channels. For instance, removing a filter from a data grid (e.g., by instrument, trade, or time range) while keeping other context filters intact.
Current Limitations:
Additional Information
The issue of context clearing was most recently discussed at the #1215 Standard WG Meeting and several possible solutions were floated.
fdc3.nothing
to include an optionalsubType
field to indicate a specific contextclearContext
channel methodid
fields to indicate a cleared contexttype
param or by adding thetype
to the existingmetadata
paramNo decision was made, but there was general consensus that any solution would need to address both requirements of:
currentContext
state in the desktop agent*
and individual context listenersProposed Solution
A combination of the first two options would address both the above requirements.
Extend
fdc3.nothing
contextsubType
is not provided it represents a lack of context as per the existing behaviour.subType
is provided it indicates the lack of the specified context.E.g.
Addition of a
Channel.clearContext
methodFunctionality:
getCurrentContext
will receive anull
value for the cleared context typefdc3.nothing
context typesubType
is providedsubType
is omittedNOTE: Any direct listeners to the cleared
subType
would not receive any updates as the existing type contract expects that they would only get updates of the context being cleared. As such any consuming application would need to explicitly opt-in to context clearing updates with a separate listener offdc3.nothing
contexts.E.g.
Rationale for Hybrid Approach
clearContext
method directly updates the FDC3 internal context state in a declarative way that matches existing methods.fdc3.nothing
with asubType
allows context listeners to opt-in to receive specific contexts that have been cleared, without requiring major breaking changes to existing context listenersSome trade-offs:
Some edge cases:
fdc3.nothing
withsubType
is broadcast directly rather than triggered by a call toclearContext
? Would the internal context still be cleared?The text was updated successfully, but these errors were encountered: