Skip to content

Commit

Permalink
feat: Allow to deactivate disconnection popup by configuration (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed May 30, 2024
1 parent 0d69639 commit 42b7f98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/client/composables/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { restoreSession } from '../utils/utils.session.js'

export function useSession (options = {}) {
// Data
const disconnectKey = 'disconnect-dialog'
const reconnectKey = 'reconnect-dialog'
const router = useRouter()
const route = useRoute()
const $q = useQuasar()
Expand Down Expand Up @@ -77,6 +79,8 @@ export function useSession (options = {}) {
if (!pendingReconnection && !ignoreReconnectionError) {
Events.emit('disconnected')
logger.error(new Error('Socket has been disconnected'))
// Disconnect prompt can be avoided, eg in tests
if (!LocalStorage.get(disconnectKey, true)) return
// This will ensure any operation in progress will not keep a "dead" loading indicator
// as this error might appear under-the-hood without notifying service operations
Loading.hide()
Expand Down Expand Up @@ -118,6 +122,8 @@ export function useSession (options = {}) {
// Display it only the first time the reconnection occurs because multiple attempts will be tried
if (!pendingReload) {
Events.emit('reconnected')
// Reconnect prompt can be avoided, eg in tests
if (!LocalStorage.get(reconnectKey, true)) return
pendingReload = $q.dialog({
title: i18n.t('composables.session.INFORMATION'),
message: i18n.t('composables.session.RECONNECT'),
Expand Down

0 comments on commit 42b7f98

Please sign in to comment.