Skip to content

fix(offline): reject synchronized Web storage - #64

Merged
rdlabo merged 1 commit into
mainfrom
feat/offline-web-mode-guard
Aug 12, 2026
Merged

fix(offline): reject synchronized Web storage#64
rdlabo merged 1 commit into
mainfrom
feat/offline-web-mode-guard

Conversation

@rdlabo

@rdlabo rdlabo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary\n\n- fail fast when synchronized offline mode is configured on Web\n- keep Web readCacheOnly and native synchronized modes supported\n- document the cross-tab locking boundary\n\n## Verification\n\n- offline contract 7/7\n- Kit lint\n


Open in Devin Review

@netlify

netlify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploy Preview for rdlabo-ionic-angular-library ready!

Name Link
🔨 Latest commit 4f3e510
🔍 Latest deploy log https://app.netlify.com/projects/rdlabo-ionic-angular-library/deploys/6a7c611874193b000898af85
😎 Deploy Preview https://deploy-preview-64--rdlabo-ionic-angular-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment on lines +136 to +140
if (platform === 'web' && mode === 'synchronized') {
throw new Error(
'Offline synchronized mode is not supported on Web. Use readCacheOnly until the Web repository provides cross-tab locking.',
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Web以外の非ネイティブ環境では未対応の同期モードが素通りしてしまう

同期モードの拒否判定がプラットフォーム名を「web」と厳密一致で比較しているため(assertSupportedOfflineModeprojects/kit/offline/src/lib/offline-provider.ts:136)、iOS/Android 以外でブラウザ保存が使われる環境では警告なく起動してしまいます。
Impact: 想定外の環境で同期書き込みが有効になり、保存待ちデータが失われる可能性があります。

リポジトリ選択条件との不一致

selectOfflineRepository (projects/kit/offline/src/lib/offline-repository.ts:206-212) は ios / android 以外のすべてのプラットフォームで Web 用の Ionic Storage リポジトリを返します。つまり electron などのカスタムプラットフォーム識別子でも、クロスタブロックを持たない Web リポジトリが使われます。一方で今回追加されたガードは platform === 'web' のときだけ例外を投げるため、同じ Web リポジトリを使う非 web プラットフォームでは synchronized モードがそのまま許可されます。判定条件をリポジトリ選択と同じ述語(platform !== 'ios' && platform !== 'android')に揃えるべきです。

Suggested change
if (platform === 'web' && mode === 'synchronized') {
throw new Error(
'Offline synchronized mode is not supported on Web. Use readCacheOnly until the Web repository provides cross-tab locking.',
);
}
if (platform !== 'ios' && platform !== 'android' && mode === 'synchronized') {
throw new Error(
'Offline synchronized mode is not supported on Web. Use readCacheOnly until the Web repository provides cross-tab locking.',
);
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@rdlabo
rdlabo force-pushed the feat/offline-web-mode-guard branch from ea555f2 to 4f3e510 Compare August 12, 2026 12:03
@rdlabo
rdlabo merged commit cf52d4f into main Aug 12, 2026
12 checks passed
@rdlabo
rdlabo deleted the feat/offline-web-mode-guard branch August 12, 2026 12:16
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.

1 participant