Call onboarding dialog only once
#144
Open
jose
wants to merge 1 commits from onboarding-dialog-fix
into master
pull from: onboarding-dialog-fix
merge into: trent_larson:master
trent_larson:ai-context
trent_larson:android-15-check
trent_larson:app-portrait-mode-lock
trent_larson:app_id_fix
trent_larson:build-improvement
trent_larson:build-ios
trent_larson:capacitor-local-save
trent_larson:contacts-view-fixes
trent_larson:cross-platform-factory
trent_larson:cross-platform-factory-redux
trent_larson:d9085ced6df7dc7bdcd899959cea6489cab7f8b8
trent_larson:db-backup-cross-platform
trent_larson:deep-fix
trent_larson:deep-link
trent_larson:deep-link-redirect
trent_larson:deep-link-redirect-server
trent_larson:deep-links-android-update
trent_larson:deep_linking
trent_larson:design-tweaks-2023-12
trent_larson:elec-tweak
trent_larson:electron_fix_20250317
trent_larson:experimental_plugin
trent_larson:eye-slash
trent_larson:feat/image-feed-view-improvements
trent_larson:fix-did-specifics
trent_larson:fix-service-worker
trent_larson:friend-tech-inspired-pwa-dialog
trent_larson:gifting-periphery-improvements
trent_larson:gifting-ui-2025-05
trent_larson:home-icon-enhancements
trent_larson:home-view-notification-improvements
trent_larson:homeview-cleanup-2025-03
trent_larson:homeview-refresh-2025-02
trent_larson:invite-client-side
trent_larson:main
trent_larson:master
trent_larson:master-settings-upgrade
trent_larson:matthew-scratch-2025-06-28
trent_larson:migrate-dexie-to-sqlite
trent_larson:new-storage
trent_larson:nostr
trent_larson:notification-request-permission-dialog
trent_larson:notify-time
trent_larson:offer-edit
trent_larson:passkey
trent_larson:passkey-cache
trent_larson:photo-reverse
trent_larson:plan-loc
trent_larson:playwright-pwa-install-test
trent_larson:profile-pic
trent_larson:project-gives
trent_larson:qrcode-capacitor
trent_larson:qrcode-reboot
trent_larson:registration-gate
trent_larson:remove-old-alerts
trent_larson:search-map-fix
trent_larson:side_step
trent_larson:simple-signer
trent_larson:split_build_process
trent_larson:sql-absurd-sql
trent_larson:sql-absurd-sql-back
trent_larson:sql-absurd-sql-further
trent_larson:sql-wa-sqlite
trent_larson:starred-projects
trent_larson:streamline-attempt
trent_larson:sw-cleanup
trent_larson:tmp
trent_larson:trent-tweaks
trent_larson:tweaks
trent_larson:ui-fixes-2024-03
trent_larson:ui-fixes-2025-03
trent_larson:ui-fixes-2025-06-w2
trent_larson:v-onboarding-2024-04
trent_larson:vite-version
trent_larson:why-migrate-fail
Reviewers
Request review
No reviewers
Labels
Apply labels
Clear labels
No items
No Label
Milestone
Set milestone
Clear milestone
No items
No Milestone
Assignees
Assign users
Clear assignees
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This pull request currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch 'onboarding-dialog-fix'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
}
if (!settings.finishedOnboarding) {
if (this.needsOnboarding) {
Note that there is a hole in the logic: needsOnboarding is never set to false after they have seen it. (It may not cause a problem because we always recheck, but it does mean that this new variable doesn't always reflect the true state of the user.)
Another possible complication is: after they finish onboarding, they no longer need onboarding, so this method will always check the DB again. (That doesn't seem like it'll cause a problem; I just mention it because I think it's not intended because we keep checking the flag.)
This is a common problem with new state variables. If you ever get a chance to play with functional programming (eg. Haskell, Scheme, LISP) then it'll be interesting how it makes you think differently... and you're able to avoid a lot of state variables in the classes because you always pass all the variables you need.
Anyway, I think it would be fine to eliminate the needsOnboarding flag and always check with retrieveSettingsForActiveAccount in here. That way we don't have to worry about setting a variable. (Another more efficient option is to eliminate that additional DB check here and pass in the flag to the checkOnboarding method from above -- but if it makes things more complicated and harder to understand then it's not worthwhile.)