Repository navigation
fix(connection): close the no internet dialog once the connection is back - #266
Merged
Merged
Conversation
tonyco97
marked this pull request as ready for review
November 17, 2026 13:03
edospadoni
approved these changes
Nov 17, 2026
edospadoni
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks!
mainStore.set(): confirmed.account/authinoare the same references as inthis.store, so they never produce a diff, and any primitive already held by another key (cameraPermission: true,isCallsEnabled: false) was silently dropped. As a side effect this also stops the periodiccheckConnection()in main from re-emittingUPDATE_CONNECTION_STATEon every cycle, sincestore.store.connectionis now kept in sync. The other callers passforceor'dark'/'light'themes, so their behaviour does not change, and there is no feedback loop becauseSHARED_STATE_UPDATEDonly updates the local state.- PhoneIsland internet handlers: the refs are the right fix for the stale closures of listeners registered once.
Non-blocking notes:
updateStore()still uses the samedifferencecheck. In practice it doesn't trigger, because state coming from the renderer through IPC always carries new object references, but it's worth aligning in a follow-up.- The
?.in(this.store as any)?.[selector]isn't needed, sincestoreis always initialized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference:
Once the "No internet connection" dialog is shown, it never closes: "Refresh" does nothing and the dialog does not close by itself when the connection is back. The only way out is to restart NethLink.
Changes
mainStore.set()compares only the value of the changed key.lodash.difference, so a value was discarded whenever another key already held it. SincecameraPermission: trueis in the store (1.6.0-testing.10),set('connection', true)is always discarded and "Refresh" never reaches the windows. In the same wayset('connection', false)was discarded whileisCallsEnabledisfalse.force(account,auth,themefrom the account controller,cameraPermission), orthemevalues (dark/light) that no other key holds.accountandconnectionthrough refs.phone-island-internet-connectedcompared against the firstconnectionvalue (true) and never restored it.Validation
npm run typecheck: OK.npm run build: OK.npx eslinton the changed files: 0 errors, same warnings asmain.mainStore.tsofmainand of this branch, bundled and run with a mockedelectron: same results for every case (theme,accountwith and withoutforce,cameraPermission, unchanged values) exceptconnectionfalse → trueandtrue → false, now applied and broadcast.End-to-end on the production build (
file://renderer,electron .onout/), same logged in user, driven through the Chrome DevTools Protocol. The dialog is opened by dispatchingphone-island-internet-disconnectedin the PhoneIsland window:mainphone-island-internet-connectedevents suppressed (dialog still open after 7 s without clicking)The Refresh check can't be tested with
npm run dev: fromhttp://localhost:5173the connectivity endpoints are blocked by CORS, so the check always reports offline. In the packaged app the renderer is loaded fromfile://and the check works.