Skip to content

Commit

Permalink
fix #162
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Nov 23, 2023
1 parent 5a6c826 commit f626b66
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.0-beta-7
* don't create duplicates in rest history when sending the same request again, fixes [#162][i162]

[i162]: https://github.com/cars10/elasticvue/issues/162

## 1.0.0-beta-6

* adds confirm when closing indices, fixes [#153][f153]
Expand Down
5 changes: 4 additions & 1 deletion src/composables/components/rest/RestQueryForm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, ref } from 'vue'
import { computed, ref, toRaw } from 'vue'
import { buildFetchAuthHeader } from '../../../helpers/elasticsearchAdapter.ts'
import { REQUEST_DEFAULT_HEADERS } from '../../../consts'
import { useConnectionStore } from '../../../store/connection'
Expand Down Expand Up @@ -64,6 +64,9 @@ export const useRestQueryForm = (request: IdbRestQueryTabRequest, response: IdbR
}

const saveToHistory = (request: IdbRestQueryTabRequest) => {
const prev = toRaw(restQueryHistory.last())
if (prev?.method === request.method && prev?.path === request.path && prev?.body === request.body) return

restQueryHistory.insert({
path: request.path,
method: request.method,
Expand Down
4 changes: 4 additions & 0 deletions src/db/indexeddb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class DbModel<T> {
this.all = ref([])
}

last () {
return this.all.value[this.all.value.length - 1]
}

async reload () {
await this.db.connect()

Expand Down

0 comments on commit f626b66

Please sign in to comment.