Commit 12a4027f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'tz-issue-detail-reduce-repaint' into 'master'

Fixes Repainting problem on the issue page

See merge request gitlab-org/gitlab!42204
parents 8cbcb9d6 5b0e232c
import { sanitize } from 'dompurify';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import updateDescription from '../utils/update_description'; import updateDescription from '../utils/update_description';
...@@ -27,8 +28,8 @@ export default class Store { ...@@ -27,8 +28,8 @@ export default class Store {
const details = const details =
descriptionSection != null && descriptionSection.getElementsByTagName('details'); descriptionSection != null && descriptionSection.getElementsByTagName('details');
this.state.descriptionHtml = updateDescription(data.description, details); this.state.descriptionHtml = updateDescription(sanitize(data.description), details);
this.state.titleHtml = data.title; this.state.titleHtml = sanitize(data.title);
this.state.lock_version = data.lock_version; this.state.lock_version = data.lock_version;
} }
......
import { sanitize } from 'dompurify'; import { sanitize } from 'dompurify';
// We currently load + parse the data from the issue app and related merge request
let cachedParsedData;
export const parseIssuableData = () => { export const parseIssuableData = () => {
try { try {
if (cachedParsedData) return cachedParsedData;
const initialDataEl = document.getElementById('js-issuable-app-initial-data'); const initialDataEl = document.getElementById('js-issuable-app-initial-data');
const parsedData = JSON.parse(initialDataEl.textContent.replace(/"/g, '"')); const parsedData = JSON.parse(initialDataEl.textContent.replace(/"/g, '"'));
...@@ -9,6 +14,8 @@ export const parseIssuableData = () => { ...@@ -9,6 +14,8 @@ export const parseIssuableData = () => {
parsedData.initialTitleHtml = sanitize(parsedData.initialTitleHtml); parsedData.initialTitleHtml = sanitize(parsedData.initialTitleHtml);
parsedData.initialDescriptionHtml = sanitize(parsedData.initialDescriptionHtml); parsedData.initialDescriptionHtml = sanitize(parsedData.initialDescriptionHtml);
cachedParsedData = parsedData;
return parsedData; return parsedData;
} catch (e) { } catch (e) {
console.error(e); // eslint-disable-line no-console console.error(e); // eslint-disable-line no-console
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment