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

feature: make NetInfo injectable/truly optional #145

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

jankapunkt
Copy link
Member

Summary

This makes NetInfo a true optional dependency.

If Meteor.connect options contain NetInfo: null it will not be imported and not used. Users need to manually connect/reconnect.

If the options is a custom NetInfo (injected) then this will be used.

Otherwise the default NetInfo is loaded.

This allows also to configure netinfo in a much more custom basis than previously.

Linked issue(s)

#143

Involved parts of the project

Meteor.connect / DDP.connect

Added tests?

yes

Targeted Meteor release version

Reproduction

Clone, ceckout branch, run tests
A test release is provided soon

@bratelefant
Copy link
Collaborator

Should we generally discuss connection managment (maybe at some other place)? I tend to use App State to disconnect when the app is sent to background, and reconnect when the app is reopened. This saves a lot of server resources, since otherwise the sockets remain open at least for a while. However, I have some reconnection issues, don't know if this interferes with NetInfo.

How does the connection state get managed if no NetInfo is present?

@jankapunkt
Copy link
Member Author

Yes let's open a discussion in regards to a 3.0. this PR is only a fix for the linked issue so @derwaldgeist can continue development.

When netinfo is disabled there is all manually to manage right now, including disconnect and reconnect.

I also agree with Appstate as without it we have many glitches when opening the app after a certain time

src/Meteor.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@bratelefant bratelefant left a comment

Choose a reason for hiding this comment

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

Added a few comments, looks fine to me

@jankapunkt
Copy link
Member Author

Released 2.8.0-rc.0 for testing

Copy link
Collaborator

@bratelefant bratelefant left a comment

Choose a reason for hiding this comment

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

Everything looking good :)

@jankapunkt jankapunkt merged commit 7be893a into master Jan 23, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@react-native-community/netinfo not available on visionOS // workaround?
2 participants