-
Notifications
You must be signed in to change notification settings - Fork 197
Fix : more messaging flow issues #2497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… the idea in console is to use CRUD so let's just go with
|
This PR was not deployed automatically as @HarshMN2345 does not have access to the Railway project. In order to get automatic PR deploys, please add @HarshMN2345 to your workspace on Railway. |
ConsoleProject ID: Tip Cursor pagination performs better than offset pagination when loading further pages. |
WalkthroughThis PR applies targeted UI and behavior changes across multiple Svelte components: adds event stop-propagation on the image preview link; reduces a helper paragraph top margin; introduces a new boolean prop Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/routes/(console)/project-[region]-[project]/messaging/topics/topic-[topic]/+page.svelte (1)
118-124: Replace two-way binding with one-way prop onEmptySearch.Line 118 uses
bind:search={data.search}, but the EmptySearch component should only read the search prop, not modify it. Since Svelte props are reactive downward by default and only flow upward when explicitly bound, thebind:directive is unnecessary here.Change
bind:search={data.search}tosearch={data.search}for clarity and to follow Svelte's idiomatic one-way data flow pattern.The button text capitalization ("Clear Search") on line 122 is correct.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/lib/components/imagePreview.svelte(1 hunks)src/lib/elements/forms/helper.svelte(1 hunks)src/lib/layout/responsiveContainerHeader.svelte(4 hunks)src/routes/(console)/project-[region]-[project]/messaging/createMessageDropdown.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/messaging/providers/+page.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/messaging/providers/create.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/messaging/providers/createProviderDropdown.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/messaging/topics/+page.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/messaging/topics/topic-[topic]/+page.svelte(5 hunks)src/routes/(console)/project-[region]-[project]/messaging/topicsModal.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/messaging/userTargetsModal.svelte(1 hunks)
🔇 Additional comments (15)
src/lib/components/imagePreview.svelte (1)
15-16: LGTM! Event propagation fix looks correct.The
stopPropagationmodifiers prevent the link's click and mousedown events from bubbling to parent handlers, which is appropriate when the preview is embedded in other interactive components.src/routes/(console)/project-[region]-[project]/messaging/topicsModal.svelte (1)
188-188: LGTM! Text normalization improves readability.Changing to lowercase makes the provider type display more natural in the sentence context.
src/routes/(console)/project-[region]-[project]/messaging/providers/createProviderDropdown.svelte (1)
12-12: LGTM! Popover alignment update is consistent.This change aligns the dropdown to the right edge, matching the similar update in
createMessageDropdown.sveltefor UI consistency.src/routes/(console)/project-[region]-[project]/messaging/providers/create.svelte (1)
189-189: LGTM! Exit confirmation improves UX.Adding
confirmExit={true}prevents accidental loss of provider configuration in the multi-step wizard.src/routes/(console)/project-[region]-[project]/messaging/createMessageDropdown.svelte (1)
10-10: LGTM! Consistent popover alignment.This matches the alignment change in
createProviderDropdown.svelte, ensuring consistent dropdown positioning across the messaging UI.src/lib/elements/forms/helper.svelte (1)
8-8: LGTM! Margin adjustment tightens form spacing.Reducing the top margin from 8 to 6 units improves form visual density. This affects all helper text instances globally.
src/routes/(console)/project-[region]-[project]/messaging/userTargetsModal.svelte (1)
142-142: LGTM! Explicit slot assignment is clearer.Adding
slot="description"makes the slot projection explicit, which is more robust and follows Svelte best practices.src/routes/(console)/project-[region]-[project]/messaging/topics/+page.svelte (1)
73-73: No issues found. ThehasCustomFiltersOnlyprop is properly implemented.The ResponsiveContainerHeader component correctly defines the prop (default
false, typed as optional boolean), and the conditional logic (lines 119-122) properly switches betweenFiltersandQuickFiltersbased on the prop value. Usage is consistent across both messaging pages.src/routes/(console)/project-[region]-[project]/messaging/providers/+page.svelte (1)
26-26: LGTM! Clean addition of custom filters flag.The
hasCustomFiltersOnlyprop enables the new custom filters UI mode for the providers page, working in conjunction with the existinghasFiltersflag.src/lib/layout/responsiveContainerHeader.svelte (2)
3-8: LGTM! Filters component properly imported.The import statement is cleanly organized to include the new
Filterscomponent needed for the custom filters UI mode.
31-31: LGTM! Prop properly defined with backward-compatible default.The
hasCustomFiltersOnlyprop is correctly defined with a default value offalse, ensuring existing component usages continue to work without modification.Also applies to: 42-42
src/routes/(console)/project-[region]-[project]/messaging/topics/topic-[topic]/+page.svelte (4)
75-75: LGTM! Terminology updated for consistency.The notification message now uses "created" instead of "have been added", which aligns with the broader terminology shift to "create" throughout the subscriber management flow.
91-91: LGTM! Placeholder text normalized.The placeholder text now uses singular "ID" instead of "IDs", which is more standard and consistent with search placeholders elsewhere in the codebase.
102-102: LGTM! Button label updated for clarity.The button label now uses "Create subscriber", which more accurately reflects the action of creating new subscriber entities rather than just adding existing ones.
141-141: LGTM! Modal description updated for consistency.The description now uses "Create subscribers" instead of "Add subscribers", maintaining consistent terminology throughout the subscriber creation flow.
| {#if hasCustomFiltersOnly} | ||
| <Filters query="[]" {columns} {analyticsSource} /> | ||
| {:else} | ||
| <QuickFilters {columns} {analyticsSource} {filterCols} /> | ||
| {/if} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify the hardcoded query="[]" value.
The Filters component is being passed a hardcoded query="[]", which means it won't reflect any existing query state from URL parameters. In contrast, in file src/routes/(console)/project-[region]-[project]/messaging/topics/topic-[topic]/+page.svelte (line 93), the Filters component receives query={data.query} from server data.
This could lead to a UX issue where active filters from URL params aren't displayed in the UI when using hasCustomFiltersOnly mode.
Consider whether the query should be:
- Passed as a prop to
ResponsiveContainerHeader(similar to other props likecolumns,analyticsSource) - Derived from URL search params within the component
- Intentionally hardcoded to
"[]"(please confirm if this is the expected behavior)
Run the following script to check how Filters component is used elsewhere in the codebase:
🏁 Script executed:
#!/bin/bash
# Search for other usages of the Filters component to understand the expected query prop pattern
rg -n -A2 -B2 '<Filters\s+query=' --type=svelteLength of output: 30
🏁 Script executed:
#!/bin/bash
# Search for Filters component usages across all files
# Try without the type restriction
rg -n -A2 -B2 '<Filters\s+query=' Length of output: 3402
🏁 Script executed:
#!/bin/bash
# Also search for all Filters component usages to understand the pattern
rg -n '<Filters' --glob='*.svelte' | head -50Length of output: 1116
🏁 Script executed:
#!/bin/bash
# Check the specific file for context around the hardcoded query
cat src/lib/layout/responsiveContainerHeader.svelte | sed -n '110,130p'Length of output: 1045
🏁 Script executed:
#!/bin/bash
# Check the referenced comparison file
cat src/routes/*/project-*/messaging/topics/topic-*/+page.svelte 2>/dev/null || echo "File pattern not found, searching..."
fd -e svelte 'topic' --exec grep -l 'Filters.*query=' {} \;Length of output: 5835
🏁 Script executed:
#!/bin/bash
# Check the component definition and props
head -50 src/lib/layout/responsiveContainerHeader.svelteLength of output: 1915
🏁 Script executed:
#!/bin/bash
# Search for how responsiveContainerHeader is used throughout the codebase
rg -n 'responsiveContainerHeader' --glob='*.svelte' -B2 -A5Length of output: 0
🏁 Script executed:
#!/bin/bash
# Search for how the component is imported/exported
rg -n 'responsiveContainerHeader' -C3Length of output: 419
🏁 Script executed:
#!/bin/bash
# Check the lib layout index to see what's exported
cat src/lib/layout/index.ts 2>/dev/null || cat src/lib/layout/index.js 2>/dev/null || echo "No index found"Length of output: 1653
🏁 Script executed:
#!/bin/bash
# Look at what's in the layout directory
ls -la src/lib/layout/Length of output: 2251
🏁 Script executed:
#!/bin/bash
# Search for where ResponsiveContainerHeader might be used
rg -in 'ResponsiveContainerHeader|responsive.*container.*header' --glob='*.svelte'Length of output: 3933
🏁 Script executed:
#!/bin/bash
# Check if hasCustomFiltersOnly is used anywhere
rg -n 'hasCustomFiltersOnly' --glob='*.svelte' -B2 -A2Length of output: 2505
🏁 Script executed:
#!/bin/bash
# Check a few actual ResponsiveContainerHeader usages to see their context
sed -n '15,40p' src/routes/\(console\)/project-\[region\]-\[project\]/messaging/topics/\+page.svelteLength of output: 931
🏁 Script executed:
#!/bin/bash
# Check the messaging/providers page for data.query availability
sed -n '1,50p' 'src/routes/(console)/project-[region]-[project]/messaging/providers/+page.svelte'Length of output: 1841
🏁 Script executed:
#!/bin/bash
# Check the messaging/topics page for data.query availability
sed -n '1,100p' 'src/routes/(console)/project-[region]-[project]/messaging/topics/+page.svelte'Length of output: 3357
🏁 Script executed:
#!/bin/bash
# Check if data.query is available in messaging topics page - look for +page.server.ts
cat 'src/routes/(console)/project-[region]-[project]/messaging/topics/+page.server.ts' 2>/dev/null | head -80Length of output: 0
🏁 Script executed:
#!/bin/bash
# Check the page.ts or +page.ts for these routes
cat 'src/routes/(console)/project-[region]-[project]/messaging/topics/+page.ts' 2>/dev/null | head -80Length of output: 1184
🏁 Script executed:
#!/bin/bash
# Check the PageData type definition
fd -e 'ts' '\$types' 'src/routes/(console)/project-[region]-[project]/messaging/topics/' --exec cat {} \;Length of output: 0
🏁 Script executed:
#!/bin/bash
# Confirm data.query is returned in the page load for messaging/topics
grep -n 'query' 'src/routes/(console)/project-[region]-[project]/messaging/topics/+page.ts'Length of output: 184
🏁 Script executed:
#!/bin/bash
# Check if messaging/providers also has data.query
cat 'src/routes/(console)/project-[region]-[project]/messaging/providers/+page.ts' 2>/dev/null | grep -A5 -B5 'query'Length of output: 962
Add query prop to ResponsiveContainerHeader and pass it to the Filters component.
The hardcoded query="[]" on line 120 prevents custom filters from displaying saved filter state. Both pages using hasCustomFiltersOnly=true (messaging/topics and messaging/providers) have data.query available from their page loaders, but cannot pass it to the component since the query prop doesn't exist.
This breaks the established pattern: all other direct Filters usages in the codebase receive query={data.query}.
Required changes:
- Add
query?: stringto the component's prop definition - Update line 120 to pass
{query}instead ofquery="[]" - Update both pages to pass
query={data.query}when settinghasCustomFiltersOnly
🤖 Prompt for AI Agents
In src/lib/layout/responsiveContainerHeader.svelte around lines 119-123, the
Filters invocation uses a hardcoded query="[]" which prevents restoring saved
filter state; add a new optional prop to the component (query?: string) in the
component's prop definition, change the Filters call on line 120 to pass {query}
instead of query="[]", and update the two pages that set hasCustomFiltersOnly
(messaging/topics and messaging/providers) to pass their loader value as
query={data.query} when rendering this component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/routes/(console)/project-[region]-[project]/messaging/topicsModal.svelte(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: e2e
- GitHub Check: build
🔇 Additional comments (6)
src/routes/(console)/project-[region]-[project]/messaging/topicsModal.svelte (6)
19-22: LGTM: Clean public API.The exported props are well-typed and the default value for
titleprovides good ergonomics.
26-31: LGTM: State variables properly initialized.The migration from
$stateto plain local variables is clean, with sensible default values.
88-98: LGTM: Correct reactivity pattern.The function properly creates a new object reference to trigger Svelte reactivity when updating selections.
111-116: LGTM: Clean reactive derivations.The computed values
selectedSize,hasSelection, andtopicSelectionStatesare properly derived from their dependencies.
118-120: Verify the initialization order is intentional.This reactive block resets
selectedtotopicsByIdwhenevershowbecomes true. Combined with lines 100-102 (which also react toshowand callrequest()), the execution order might be:
- Lines 100-102 run and call
request()- Lines 118-120 run and reset
selectedThis means
selectedis restored from props after the API request is triggered. If this is intentional (e.g., to restore previously selected topics when reopening the modal), consider adding a comment. If not, you might want to consolidate the initialization logic.
172-172: LGTM: Improved empty state messaging.The conditional inclusion of
providerType.toLowerCase()provides clearer context when there are topics but none with the required target type.
| $: if (show) { | ||
| request(); | ||
| }); | ||
| $effect(() => { | ||
| if (show && !wasOpen) { | ||
| selected = topicsById; | ||
| } | ||
| wasOpen = show; | ||
| }); | ||
| } | ||
| $: if (offset !== null) { | ||
| request(); | ||
| } | ||
| $: if (search !== null) { | ||
| offset = 0; | ||
| request(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix reactive blocks to prevent duplicate API calls.
The current reactive blocks have several issues:
-
Lines 103-105 and 106-109: The conditions
if (offset !== null)andif (search !== null)are always true sinceoffsetis a number (initialized to 0) andsearchis a string (initialized to ''), causing these blocks to run on every component mount and on every change. -
Cascading triggers: When
searchchanges, line 107 setsoffset = 0, which then triggers lines 103-105 again, causingrequest()to be called twice. -
Initial mount: All three reactive blocks will execute on component mount, potentially triggering multiple simultaneous API calls.
This leads to wasted API calls, potential race conditions, and unpredictable results.
Consider refactoring to a single reactive block with proper dependency tracking:
- $: if (show) {
- request();
- }
- $: if (offset !== null) {
- request();
- }
- $: if (search !== null) {
- offset = 0;
- request();
- }
+ $: if (show) {
+ offset = 0;
+ search = '';
+ }
+
+ $: if (show || offset >= 0 || search !== undefined) {
+ request();
+ }Alternatively, use separate reactive blocks with proper guards:
- $: if (show) {
- request();
- }
- $: if (offset !== null) {
- request();
- }
- $: if (search !== null) {
+ let prevSearch = search;
+ $: if (search !== prevSearch) {
+ prevSearch = search;
offset = 0;
- request();
}
+
+ $: show, offset, search, request();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| $: if (show) { | |
| request(); | |
| }); | |
| $effect(() => { | |
| if (show && !wasOpen) { | |
| selected = topicsById; | |
| } | |
| wasOpen = show; | |
| }); | |
| } | |
| $: if (offset !== null) { | |
| request(); | |
| } | |
| $: if (search !== null) { | |
| offset = 0; | |
| request(); | |
| } | |
| $: if (show) { | |
| offset = 0; | |
| search = ''; | |
| } | |
| $: if (show || offset >= 0 || search !== undefined) { | |
| request(); | |
| } |
🤖 Prompt for AI Agents
In src/routes/(console)/project-[region]-[project]/messaging/topicsModal.svelte
around lines 100-109, the three reactive blocks cause duplicate API calls
because offset and search are never null, search resets offset which re-triggers
the offset block, and all blocks run on mount; replace these with a single
reactive block that depends on show, offset, and search (or use separate blocks
with proper guards) so request() is only called once per meaningful
change—specifically, consolidate logic to check show before calling request,
debounce or guard search changes by setting offset and then calling request in
the same block (avoid setting offset in one reactive and relying on another to
call request), and ensure initial mount triggers a single request by using a
single $: block that early-returns when show is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/routes/(console)/project-[region]-[project]/messaging/message-[message]/updateTargets.svelte (1)
219-229: Inconsistent empty state styling between draft and non-draft modes.The non-draft empty state now uses
PinkEmptywrapped inCard.Base, but Line 217 still uses the oldEmptycomponent for draft mode. This creates visual inconsistency in the user experience.Consider updating Line 217 to also use the new Pink design system components for consistency. (Documentation link verified as accessible.)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/routes/(console)/project-[region]-[project]/messaging/message-[message]/updateTargets.svelte(3 hunks)
🔇 Additional comments (1)
src/routes/(console)/project-[region]-[project]/messaging/message-[message]/updateTargets.svelte (1)
15-25: Good use of aliasing to avoid naming conflicts.The import structure correctly uses
Empty as PinkEmptyto differentiate between the two Empty components from different libraries. All imports are properly organized and used in the component.
src/routes/(console)/project-[region]-[project]/messaging/providers/create.svelte
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this moved from svelte5 to 4?
…iders/create.svelte Co-authored-by: Darshan <[email protected]>

What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit
New Features
Bug Fixes
Style
Content