Fix edit annotation rendering speed
The editTemplateVariableNames action would fire way too many times. This cause poor rendering speeds with annotations.pull/3159/head
parent
919e14a7ec
commit
37b50cb956
|
@ -4,19 +4,27 @@ import queryString from 'query-string'
|
|||
import {enablePresentationMode} from 'src/shared/actions/app'
|
||||
import {templateVariablesSelectedByName} from 'src/dashboards/actions'
|
||||
|
||||
export const queryStringConfig = () => next => action => {
|
||||
next(action)
|
||||
const qs = queryString.parse(window.location.search)
|
||||
export const queryStringConfig = () => {
|
||||
let prevPath
|
||||
return next => action => {
|
||||
next(action)
|
||||
const qs = queryString.parse(window.location.search)
|
||||
|
||||
// Presentation Mode
|
||||
if (qs.present === 'true') {
|
||||
next(enablePresentationMode())
|
||||
}
|
||||
// Presentation Mode
|
||||
if (qs.present === 'true') {
|
||||
next(enablePresentationMode())
|
||||
}
|
||||
|
||||
// Select Template Variable By Name
|
||||
const dashboardRegex = /\/sources\/(\d+?)\/dashboards\/(\d+?)/
|
||||
if (dashboardRegex.test(window.location.pathname)) {
|
||||
const dashboardID = window.location.pathname.match(dashboardRegex)[2]
|
||||
next(templateVariablesSelectedByName(+dashboardID, qs))
|
||||
// Select Template Variable By Name
|
||||
const dashboardRegex = /\/sources\/(\d+?)\/dashboards\/(\d+?)/
|
||||
if (dashboardRegex.test(window.location.pathname)) {
|
||||
const currentPath = window.location.pathname
|
||||
const dashboardID = currentPath.match(dashboardRegex)[2]
|
||||
if (currentPath !== prevPath) {
|
||||
next(templateVariablesSelectedByName(+dashboardID, qs))
|
||||
}
|
||||
|
||||
prevPath = currentPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue