Skip to content

Commit f4828c2

Browse files
Fix conversation search and list to morph on refresh (#581)
Co-authored-by: Keith Schacht <[email protected]>
1 parent 64004c4 commit f4828c2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

app/javascript/stimulus/search_controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ export default class extends Controller {
55

66
inputTargetConnected() {
77
this.setSearchClearIcon()
8+
// Ensure the cursor is at the end of the input
9+
this.inputTarget.selectionStart =
10+
this.inputTarget.selectionEnd =
11+
this.inputTarget.value.length
812
}
913

1014
disconnect() {

app/views/conversations/index.html.erb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<turbo-frame data-turbo-permanent id="nav-conversations">
1+
<turbo-frame id="nav-conversations">
22
<section id="search"
33
class="pt-6 text-gray-950 dark:text-gray-100 select-none"
44
>
@@ -17,11 +17,12 @@
1717
w-full
1818
p-2 py-1
1919
border border-gray-200 rounded-lg
20-
text-black dark:text-gray-800
20+
text-black dark:text-gray-200
21+
placeholder-gray-300 dark:placeholder-gray-500
22+
bg-transparent
2123
|,
2224
data: {
2325
search_target: "input",
24-
turbo_permanent: true,
2526
action: %|
2627
blur->search#unfocus
2728
input->search#search

app/views/messages/_nav_column.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727

2828
<turbo-frame id="nav-conversations"
2929
src="<%= conversations_path(conversation_id: @conversation&.id) %>"
30+
refresh="morph"
3031
loading="lazy"
3132
/>

0 commit comments

Comments
 (0)