Migrate rest of modules to pinia, remove vuex, replace lodash with lodash-es #3571
No reviewers
Labels
No labels
BE Request
Backlog
Better behavior
Blocked by deps
Bug
Code Review
Discussion
Doing
Feature Request / Enhancement
In the shining bright future maybe
It's complicated
MS Edge
Mememoon (or other niche browsers)
Missing API
Missing feature
Missing l10n/i18n
NL1
NL2
NL4
Need to verify on develop
RELEASE BLOCKER
Reassign or Close
Refactor
Regression
Safari
To Do
User story
Waiting on godot
accessibility
better documentation
chore
confirmed
easy ticket
incident
l10n update
mastoapi
mobile
needs design
needs-info
needs-review
stupid
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
pleroma/pleroma-fe!3571
Loading…
Reference in a new issue
No description provided.
Delete branch "vuex-removal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
/oc review
opencode-agent:job=80:generation=1
Automated review of
d603aac3→2731ea81(27 commits, 58 files, +890/−1183), done for/oc review.Verdict
A thorough, near-complete vuex → pinia migration: no
vuex/$store/window.vuex/ vuexmapGetters/commit/dispatchreferences remain anywhere insrc/ortest/, the removedmodules/{api,drafts,index}.jshave no dangling importers, and the unit suite passes at the same level asdevelop(418 passed / 1 failed / 2 skipped — the one failure and the two MSW-dependent spec files fail identically at base; verified by running the suite at both commits). But there are a few small, real regressions I'd want fixed before merge.Should fix (likely regressions)
src/stores/users.js:709— typoerror.tatusCode(waserror.statusCode), so a 401 login failure reports the generic "An error occurred…" instead of "Wrong username or password". Not caught by tests: the bad-credentials spec uses 403.src/components/emoji_input/suggestor.js:18—const usersCurry = data.store && suggestUsers(data.store)still gates ondata.store, but this PR removedstore: this.$storefrom both callers (post_status_form.js/user_card.jsemojiUserSuggestor). Net effect:@-mention user suggestions are dead in the composer and user-card fields.suggestUsers()is arg-less and pinia-based, so the gate can simply be dropped.src/components/side_drawer/side_drawer.js:113—mapState(useDraftsStore, ['draftCount']), but the pinia getter isdraftsCount(src/stores/drafts.js:50). The drafts badge in the side drawer is alwaysundefined/hidden. Renamed correctly everywhere else — this one spot was missed.src/stores/drafts.js:61(loadDrafts) —new Map(Object.entries(currentData))throws when thepleroma-fe-draftskey is absent (localforage resolvesnull;Object.entries(null)→ TypeError). The old vuex module guarded with|| {}; the newsaveDraftToStorage/deleteDraftFromStoragehelpers kept?? {}, butloadDraftsdidn't.loginUsercalls it un-awaited, so most users get an unhandled rejection and no drafts on every login.instance_capabilities.jshook that calledinitializeSocketwhenshoutAvailablearrived from nodeinfo was removed;loginUsernow checksshoutAvailableitself (users.js:667), butcheckOAuthTokenandgetNodeInforun concurrently inafter_store.js'sPromise.all. If login resolves before nodeinfo, the shout socket is never initialized for the session.src/stores/shout.js:13,17—tokenis declared in bothstateandgetters; pinia warns "A getter cannot have the same name as another state property" and the getter shadows the always-deadtoken: nullstate (verified against pinia 3). Drop the state field.Notes / nits
lodash-es(0 occurrences insrc/andtest/); 66 app files stillimport … from 'lodash'(CJS),lodashwas dropped from dependencies, andlodash-essits unused in devDependencies. The build only keeps working because hoisted transitivelodash@^4.17.21remains in yarn.lock — an undeclared direct dependency. Removingbabel-plugin-lodashalso means full-CJS lodash gets bundled. Either migrate the imports tolodash-esor keeplodashas an explicit dependency.src/stores/drafts.js:70—abandonAllDrafts(store)has a stray vuex-erastorearg, and it double-deletes: eachabandonDraftalready removes the draft from storage, then the bulkdeleteDraftFromStorage(ids)runs again.src/stores/follow_requests.js— throws bare strings instartFetching/stopFetching;stopFetchinguses a comma-operator one-liner; the store ↔stores/fetchers/follow_requests.jsimport cycle only works because usage is deferred to call time.follow_request_card.jsdoDenynow marks the notification seen, whilenotification.jsdoDenystill dismisses it — inconsistent UX for the same action.drafts,followRequests,profileConfig) and the newloginUser/logoutbranches (profileConfigonLogin/onLogout, shout gating, locked-user follow-request fetching) have no direct test coverage; the post_status_form draft specs themselves were ported faithfully.useFollowRequestsStore().startFetching(), so a real fetcher starts a 10 s polling loop during tests (was a no-op fallback at base).What looks good
after_store.jsthreading updated,mock_store.jsremoved with no leftover test scaffolding.piniaPersistPluginkeeps thevuex-lzlocalStorage fallback so existing users' persisted state migrates per-store — nice touch.badgesmaps) is consistent: all fourbadgeGetterkeys (drafts,followRequests,unreadChats,unreadAnnouncements) resolve, and theunreadAnnouncementsCountrename matches the store everywhere.updateNotificationSettingsnow sendsblock_from_strangers/hide_notification_contentsas snake_cased query params (viaparamsString) instead of a PUT payload, consistent with the settings-map keys.—
Generated by
opencode-fix-botfor/oc reviewon PR #3571 (basedevelop@d603aac31b787c250bc5359a08303fbd9fa4f7a8, headvuex-removal@2731ea81cbfd5f2c2872e7c3d32892089ac48cc0). Marker:opencode-agent:job=80:generation=1/oc review
opencode-agent:job=81:generation=1
Re-review of
d603aac3→6e04b28b(37 commits, 127 files, +1929/−1633 vsdevelop; 10 new commits since the previous bot review of2731ea81), done for/oc review.Previously flagged issues — all resolved
src/stores/users.js:709—error.tatusCodetypo fixed (nowerror.statusCodeat :705/:709), so 401 logins again report "Wrong username or password".src/components/emoji_input/suggestor.js:18— deaddata.store &&gate dropped;suggestUsers()is arg-less and pinia-based, so@-mention suggestions work again in the composer and user-card fields.src/components/side_drawer/side_drawer.js:113— now mapsdraftsCount, matching the pinia getter; the drafts badge is no longerundefined.src/stores/drafts.js—loadDrafts(and both storage helpers) guard reads with?? {}(:22, :28, :56), so no moreObject.entries(null)TypeError on first login;abandonAllDraftslost the stray vuex-era arg and the double-delete.instanceCapabilities.set()now callsinitializeSocket()whenshoutAvailablearrives after login (src/stores/instance_capabilities.js:46-49), andinitializeSocketno longer throws on double-init (src/stores/shout.js).src/stores/shout.js— thetokenstate/getter collision is gone (getter only).from 'lodash'imports remain insrc//test/(69 files importlodash-es), andlodash-es@4.17.21moved from devDependencies intodependencies, so it's no longer an undeclared hoisted transitive.Verification
6e04b28b(headless chromium): 471 passed / 0 failed / 2 skipped across all 37 spec files — up from 418/1/2 at the previously reviewed head. The only failure at the old head is gone, and 53 new tests cover the drafts and follow-requests stores (drafts.spec.js,follow_requests.spec.js, extendedusers.spec.jswith the follow-requests fetcher stubbed).vuex/$store/ vuexmapGetters/commit/dispatchremnants in app code; the remainingvuexreferences are the intentionalvuex-lzlocalStorage migration fallbacks.fetchAndUpdate()from the follow-requests/notifications fetchers, which previously double-fired on startup (explicit call + first loop iteration ofpromiseInterval).follow_requests.js+ new globalfollow_request_confirmmounted inApp.vue) also fixes the old bare-string throws, the comma-operatorstopFetching, and makes the API call awaited before the request entry is removed — nice cleanup of two near-duplicated component implementations.Minor notes (non-blocking)
logout()stops the follow-requests fetcher onlyif (this.currentUser.locked)(src/stores/users.js:730-731), but the failure path restarts it unconditionally (users.js:791). For a non-locked user whose logout fails,startFetching()throwsFetcher already exists!inside the catch handler → an unhandled rejection (the earlier fetcher restarts in that block still run, so state stays consistent, but it's noisy). Guarding the restart the same way the stop is guarded (capturinglockedbefore teardown) would fix it.doApprove/doDenyhide the modal and cleartempIdbefore awaiting the API call, and rejections aren't caught, so on API failure the dialog is already gone with no feedback. Old component code had the same flaw (no regression), but it's now trivially fixable in one place.dismissNotificationLocal); the unified store now always marks the follow-request notification seen instead. Consistency is welcome, but the notification now lingers (seen, not dismissed) — flagging in case that UX shift is unintentional.follow_requests → notifications → users → follow_requests— works only because usage is deferred to call time (same pattern as elsewhere in this migration), worth keeping an eye on.Verdict
All blocking regressions from the previous review are fixed and test coverage is meaningfully better. Remaining items are minor; nothing blocks merge from my side.
—
Generated by
opencode-fix-botfor/oc reviewon PR #3571 (basedevelop@d603aac31b787c250bc5359a08303fbd9fa4f7a8, headvuex-removal@6e04b28b719f95b53b526f568d69335ee577627e). Marker:opencode-agent:job=81:generation=1