From d62c76d1e83198944b5959d396225cf25ed0389c Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 7 May 2025 15:04:35 +1000 Subject: [PATCH] FIX: do not display empty state while fetching bot conversations (#1320) * FIX: do not display empty state while fetching bot conversations * skip test in playwright and fix implementation * tiny css fix, missing padding --- .../javascripts/initializers/ai-conversations-sidebar.js | 9 +++++++-- .../stylesheets/modules/ai-bot-conversations/common.scss | 4 ++++ spec/system/ai_bot/homepage_spec.rb | 6 ++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/initializers/ai-conversations-sidebar.js b/assets/javascripts/initializers/ai-conversations-sidebar.js index bf8d5636..b0b5a7a2 100644 --- a/assets/javascripts/initializers/ai-conversations-sidebar.js +++ b/assets/javascripts/initializers/ai-conversations-sidebar.js @@ -93,8 +93,9 @@ export default { @tracked loadedSevenDayLabel = false; @tracked loadedThirtyDayLabel = false; @tracked loadedMonthLabels = new Set(); - page = 0; + @tracked isLoading = true; isFetching = false; + page = 0; totalTopicsCount = 0; constructor() { @@ -123,7 +124,9 @@ export default { } get emptyStateComponent() { - return AiBotSidebarEmptyState; + if (!this.isLoading) { + return AiBotSidebarEmptyState; + } } get text() { @@ -214,6 +217,8 @@ export default { this.attachScrollListener(); } catch { this.isFetching = false; + } finally { + this.isLoading = false; } } diff --git a/assets/stylesheets/modules/ai-bot-conversations/common.scss b/assets/stylesheets/modules/ai-bot-conversations/common.scss index dce213b4..b2b7364d 100644 --- a/assets/stylesheets/modules/ai-bot-conversations/common.scss +++ b/assets/stylesheets/modules/ai-bot-conversations/common.scss @@ -389,6 +389,10 @@ body.has-ai-conversations-sidebar { color: var(--primary-high); font-size: var(--font-down-2); + &__progress { + margin-left: 0.5em; + } + &:hover, &:focus-visible { .d-icon { diff --git a/spec/system/ai_bot/homepage_spec.rb b/spec/system/ai_bot/homepage_spec.rb index 338c33cc..47ae7dcd 100644 --- a/spec/system/ai_bot/homepage_spec.rb +++ b/spec/system/ai_bot/homepage_spec.rb @@ -137,15 +137,17 @@ RSpec.describe "AI Bot - Homepage", type: :system do expect(page).to have_no_css(".ai-bot-upload") end - xit "allows removing an upload before submission" do + it "allows removing an upload before submission" do + skip "TODO: fix this test for playwright" + ai_pm_homepage.visit expect(ai_pm_homepage).to have_homepage file_path = file_from_fixtures("logo.png", "images").path attach_file([file_path]) { find(".ai-bot-upload-btn", visible: true).click } - expect(page).to have_css(".ai-bot-upload", count: 1) + # TODO: for some reason this line fails in playwright find(".ai-bot-upload__remove").click expect(page).to have_no_css(".ai-bot-upload")