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

Deprecate Container.setAutoReconnect(), Container.resume(), IContainer.connected, and IFluidContainer.connected. #9167

Closed
Tracked by #8745
scottn12 opened this issue Feb 17, 2022 · 6 comments · Fixed by #9439
Assignees
Labels
api deprecation Changes to a deprecated API
Milestone

Comments

@scottn12
Copy link
Contributor

scottn12 commented Feb 17, 2022

As described in #8745, the following APIs will be deprecated.

Contianer.setAutoReconnect()

This function is being deprecated to keep the reconnection logic internal. To replace its functionality, Container.connect() and Container.disconnect() were introduced.

Container.resume()

This function is essentially being renamed to Container.connect(). This is done to provide developers a more intuitive API to connect a container. To avoid duplicate functionality, this function will be deprecated and removed.

IContainer.connected

This API serves the same purpose as IContainer.connectionState, and therefore will be deprecated and removed.

IFluidContainer.connected

This API serves the same purpose as IFluidContainer.connectionState (newly added), and therefore will be deprecated and removed.

@vladsud
Copy link
Contributor

vladsud commented Feb 18, 2022

We are also introducing the callback argument to provide additional control for the developer. This callback function will be required when the mode is set to Custom and will evaluate as a boolean. If the value is true then the container will reconnect, and if false it will not. This allows the developer as mechanism to control when a user is or is not reconnected based on information which the developer has access to, but Fluid does not.

I think what you are trying to say is that developer wants pull model (FF asks it) vs. push model (developer changing auto-reconnect property as new data on his/her side arrives).
Before making API more complex, I'd love to understand why we believe we need to introduce more complexity and allow polling.

I have bigger issues with continuing to introduce these things on Container - I believe things like that should be exposed on Loader object, such that they apply to all containers under same context (here, "context" object is a loader, I do not think we need another context object). That way, it works great for things like guest components, where container points to a component from another container, and thus child container is loaded under same loader - doing operations on one container will miss this kind of scenario).
Developers should have ability to create any number of custom contexts (loader instances) and thus control the scoping of such policies.

@ssimic2
Copy link

ssimic2 commented Feb 22, 2022

This is a good point to consider.

If we do this at a loader level, is it still a natural place to inject callback? (Consider more complex FFX use cases around host apps). Also, maybe elaborate on "information which the developer has access to", so it's clear what those can be.

If the container is disconnected (say for an inactive tab), and you come back to it, what/who initiates reconnections?

@vladsud
Copy link
Contributor

vladsud commented Feb 22, 2022

I do not understand why callbacks are needed, so I can't answer that question. Access to information does not matter here though, as you can achieve same thing - the question is really why pull model is preferred over push, IMHO, and is this difference warrants more complicated API? Is there an example of scenario demonstrating it? I have not seen one.

Today, in FFX case, I believe OWH code initiates reconnect, I believe they use React capabilities to learn if user is there (any input generated), though I believe browser has similar capability (at global level).

@ssimic2
Copy link

ssimic2 commented Feb 22, 2022

Comments were for @scottn12 to clarify "information which the developer has access to", to understand need for callback. Scott - is this is all around "user inputs"?

@scottn12
Copy link
Contributor Author

Yes, user inputs such as mouse movements or clicks which are not accessible by Fluid. There may also be other relevant information, such as browser tab focus, for example. That said, based on feedback I received we probably won't be refactoring setAutoReconnect() after all, and I'll be updating the main issue shortly.

@scottn12 scottn12 changed the title Refactor setAutoReconnect() Adjust setAutoReconnect() to remove immediate connection/disconnect logic Feb 25, 2022
@scottn12 scottn12 changed the title Adjust setAutoReconnect() to remove immediate connection/disconnect logic [WiP] Adjust setAutoReconnect() to remove immediate connection/disconnect logic Mar 3, 2022
@scottn12 scottn12 changed the title [WiP] Adjust setAutoReconnect() to remove immediate connection/disconnect logic Deprecate Container.setAutoReconnect(), Container.resume(), and IContainer.connected Mar 8, 2022
@scottn12
Copy link
Contributor Author

scottn12 commented Mar 8, 2022

FYI, this issue has been updated to reflect the changes in #8745

@scottn12 scottn12 changed the title Deprecate Container.setAutoReconnect(), Container.resume(), and IContainer.connected Deprecate Container.setAutoReconnect(), Container.resume(), IContainer.connected, and IFluidContainer.connected. Mar 8, 2022
@scottn12 scottn12 added the api deprecation Changes to a deprecated API label Mar 8, 2022
@scottn12 scottn12 added this to the March 2022 milestone Mar 10, 2022
@scottn12 scottn12 self-assigned this Mar 10, 2022
@scottn12 scottn12 removed the triage label Mar 15, 2022
@scottn12 scottn12 modified the milestones: March 2022, April 2022 Mar 31, 2022
@skylerjokiel skylerjokiel moved this to In Review in Fluid DevX Apr 2, 2022
scottn12 added a commit that referenced this issue Apr 7, 2022
…ume()`, and `connected` (#9439)

For context on the reasoning behind these changes see: #8745

This PR adds `connect()` and `disconnect()` to `Container` and `IContainer`. These functions will combine to replace the functionality of `Container.setAutoReconnect()` (which is deprecated here). Furthermore, `connect()` is essentially a rename of `Container.resume()`, hence `resume()` has been deprecated as well.

In addition, `IContainer.connected` has been deprecated in favor of `IContainer.connectionState`. To make `IFluidContainer` consistent with these changes, `connectionState` has been added to `IFluidContainer`, and `IFluidContainer.connected` has been deprecated as well.

Follow up items:
1. Add `connect()` and `disconnect()` to `IFluidContainer` and `IContainer`
2. Add tests for the new functionality
3. Update documentation referencing deprecated APIs
4. Explore behavior if `disconnect()` is called while the container is attempting to connect

Closes #9396, #9167, #9744
Repository owner moved this from In Review to Done in Fluid DevX Apr 7, 2022
scottn12 added a commit that referenced this issue May 27, 2022
This PR removes the APIs deprecated in 0.58 via #9439, which include `Container.setAutoReconnect()`, `Container.resume()`, `IContainer.connected`, and `IFluidContainer.connected`. 
Additionally, this PR replaces any remaining usages/references of the above APIs with their respective replacements (see #9167).


Closes #9397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api deprecation Changes to a deprecated API
Projects
Status: Done
3 participants