+
No results found.
{
+ const currentChatHeight = this.$refs.chat.scrollHeight;
+ this.$refs.chat.scrollTop =
+ this.oldScrollTop + currentChatHeight - this.oldChatHeight;
+ });
+ }
},
},
mounted() {
@@ -164,7 +178,11 @@ export default {
doSearch() {
this.offset = 0;
this.$store.commit("messageSearchInProgress", true);
- this.$store.commit("messageSearchResults", null); // Only reset if not getting offset
+
+ if (!this.offset) {
+ this.$store.commit("messageSearchResults", null); // Only reset if not getting offset
+ }
+
socket.emit("search", {
networkUuid: this.$route.params.uuid,
channelName: this.$route.params.target,
@@ -175,6 +193,10 @@ export default {
onShowMoreClick() {
this.offset += 100;
this.$store.commit("messageSearchInProgress", true);
+
+ this.oldScrollTop = this.$refs.chat.scrollTop;
+ this.oldChatHeight = this.$refs.chat.scrollHeight;
+
socket.emit("search", {
networkUuid: this.$route.params.uuid,
channelName: this.$route.params.target,
diff --git a/client/js/socket-events/search.js b/client/js/socket-events/search.js
index f089f256..36cd1e4e 100644
--- a/client/js/socket-events/search.js
+++ b/client/js/socket-events/search.js
@@ -3,5 +3,11 @@ import store from "../store";
socket.on("search:results", (response) => {
store.commit("messageSearchInProgress", false);
+
+ if (store.state.messageSearchResults) {
+ store.commit("addMessageSearchResults", response);
+ return;
+ }
+
store.commit("messageSearchResults", response);
});
diff --git a/client/js/store.js b/client/js/store.js
index a648779c..2fc66a53 100644
--- a/client/js/store.js
+++ b/client/js/store.js
@@ -120,6 +120,10 @@ const store = new Vuex.Store({
messageSearchResults(state, value) {
state.messageSearchResults = value;
},
+ addMessageSearchResults(state, value) {
+ value.results = [...state.messageSearchResults.results, ...value.results];
+ state.messageSearchResults = value;
+ },
},
getters: {
findChannelOnCurrentNetwork: (state) => (name) => {