Skip to content

feature: make NetInfo injectable/truly optional#145

Merged
jankapunkt merged 3 commits intomasterfrom
feature/optional-netinfo
Jan 23, 2024
Merged

feature: make NetInfo injectable/truly optional#145
jankapunkt merged 3 commits intomasterfrom
feature/optional-netinfo

Conversation

@jankapunkt
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Copy link
Copy Markdown
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
Copy Markdown
Member Author

Released 2.8.0-rc.0 for testing

Copy link
Copy Markdown
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
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