From 56aa7de85ad695684b5bae6b0e8af94ec77f242b Mon Sep 17 00:00:00 2001 From: findwinds <994888631@qq.com> Date: Thu, 9 Feb 2023 12:24:13 +0800 Subject: [PATCH] Fix random list problem of tags and categories (#3261) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug #### What this PR does / why we need it: replaced flatMap with flatMapSequential to ensure that the list of tags and categories shown in console post order is not random #### Which issue(s) this PR fixes: Fixes #3139 #### Special notes for your reviewer: /cherrypick release-2.0 /cherrypick release-2.1 #### Does this PR introduce a user-facing change? ```release-note 修复控制台文章列表中,标签和分类顺序随机的问题 ``` --- src/main/java/run/halo/app/content/impl/PostServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/run/halo/app/content/impl/PostServiceImpl.java b/src/main/java/run/halo/app/content/impl/PostServiceImpl.java index 0c4feddf5..11311a80a 100644 --- a/src/main/java/run/halo/app/content/impl/PostServiceImpl.java +++ b/src/main/java/run/halo/app/content/impl/PostServiceImpl.java @@ -208,7 +208,7 @@ public class PostServiceImpl extends AbstractContentService implements PostServi return Flux.empty(); } return Flux.fromIterable(tagNames) - .flatMap(tagName -> client.fetch(Tag.class, tagName)); + .flatMapSequential(tagName -> client.fetch(Tag.class, tagName)); } private Flux listCategories(List categoryNames) { @@ -216,7 +216,7 @@ public class PostServiceImpl extends AbstractContentService implements PostServi return Flux.empty(); } return Flux.fromIterable(categoryNames) - .flatMap(categoryName -> client.fetch(Category.class, categoryName)); + .flatMapSequential(categoryName -> client.fetch(Category.class, categoryName)); } private Flux listContributors(List usernames) {