diff --git a/src/ui/public/metadata.js b/src/ui/public/metadata.js index 4f8103221e109..0b3897bb28e16 100644 --- a/src/ui/public/metadata.js +++ b/src/ui/public/metadata.js @@ -1,9 +1,11 @@ -import $ from 'jquery'; import _ from 'lodash'; +// singleton for immutable copy of window.__KBN__ -const state = $('kbn-initial-state').attr('data'); -const kbn = window.__KBN__ = JSON.parse(state); +if (!_.has(window, '__KBN__')) { + throw new Error('window.__KBN__ must be set for metadata'); +} +const kbn = _.cloneDeep(window.__KBN__ || {}); export default deepFreeze(kbn); function deepFreeze(object) { diff --git a/src/ui/views/chrome.jade b/src/ui/views/chrome.jade index 45f42d1086a07..646b9bd329a45 100644 --- a/src/ui/views/chrome.jade +++ b/src/ui/views/chrome.jade @@ -1,5 +1,5 @@ -- - var appName = 'kibana'; +- var j = function (o) { return JSON.stringify(o); } +- var appName = 'kibana'; block vars @@ -12,5 +12,5 @@ html(lang='en') title Kibana block head body(kbn-chrome, id='#{appName}-body') - kbn-initial-state(data=JSON.stringify(kibanaPayload)) + script window.__KBN__ = !{j(kibanaPayload)}; block content