list_edit: setListAccounts() is never an Promise<>, So don't need to use .then() #3481

Open
Yonle wants to merge 1 commit from Yonle/pleroma-fe:list_edit_fix-1 into develop
Member

in src/stores/lists.js:

    setListAccounts({ listId, accountIds }) {
      const saved = this.allListsObject[listId]?.accountIds || []
      const added = accountIds.filter((id) => !saved.includes(id))
      const removed = saved.filter((id) => !accountIds.includes(id))
      if (!this.allListsObject[listId]) {
        this.allListsObject[listId] = { accountIds: [] }
      }
      this.allListsObject[listId].accountIds = accountIds
      if (added.length > 0) {
        window.vuex.state.api.backendInteractor.addAccountsToList({
          listId,
          accountIds: added,
        })
      }
      if (removed.length > 0) {
        window.vuex.state.api.backendInteractor.removeAccountsFromList({
          listId,
          accountIds: removed,
        })
      }
    }

this function is never an Promise. The code in src/components/list_edit.js treated it as a Promise, which then yield an error:
image

this PR fixes it by not treating it as an Promise, making list creation / edit work properly again.

in `src/stores/lists.js`: ```js setListAccounts({ listId, accountIds }) { const saved = this.allListsObject[listId]?.accountIds || [] const added = accountIds.filter((id) => !saved.includes(id)) const removed = saved.filter((id) => !accountIds.includes(id)) if (!this.allListsObject[listId]) { this.allListsObject[listId] = { accountIds: [] } } this.allListsObject[listId].accountIds = accountIds if (added.length > 0) { window.vuex.state.api.backendInteractor.addAccountsToList({ listId, accountIds: added, }) } if (removed.length > 0) { window.vuex.state.api.backendInteractor.removeAccountsFromList({ listId, accountIds: removed, }) } } ``` this function is never an Promise. The code in `src/components/list_edit.js` treated it as a Promise, which then yield an error: ![image](/attachments/86cb1b72-949a-41a6-b131-eb5c0d3698d3) this PR fixes it by not treating it as an Promise, making list creation / edit work properly again.
332 KiB
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u list_edit_fix-1:Yonle-list_edit_fix-1
git switch Yonle-list_edit_fix-1

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch develop
git merge --no-ff Yonle-list_edit_fix-1
git switch Yonle-list_edit_fix-1
git rebase develop
git switch develop
git merge --ff-only Yonle-list_edit_fix-1
git switch Yonle-list_edit_fix-1
git rebase develop
git switch develop
git merge --no-ff Yonle-list_edit_fix-1
git switch develop
git merge --squash Yonle-list_edit_fix-1
git switch develop
git merge --ff-only Yonle-list_edit_fix-1
git switch develop
git merge Yonle-list_edit_fix-1
git push origin develop
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe!3481
No description provided.