summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-07-08 23:17:56 +0000
committerFatih Acet <acetfatih@gmail.com>2018-07-08 23:17:56 +0000
commit56cbff350c39f162274b3d5c9ba342fad9adb346 (patch)
treee49aee73b29047971c040f21fe49544cd3a6bc91
parent53760e8dcb2f2f8d878e10078c47bd6d6bc393fa (diff)
downloadgitlab-ce-56cbff350c39f162274b3d5c9ba342fad9adb346.tar.gz
Resolve "MR Refactor: Improve performance by setting v-once"
-rw-r--r--app/assets/javascripts/diffs/components/diff_file_header.vue1
-rw-r--r--app/assets/javascripts/diffs/components/diff_line_gutter_content.vue1
-rw-r--r--app/assets/javascripts/diffs/components/diff_table_cell.vue8
-rw-r--r--app/assets/javascripts/diffs/components/inline_diff_table_row.vue11
-rw-r--r--app/assets/javascripts/diffs/components/parallel_diff_table_row.vue28
5 files changed, 20 insertions, 29 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue
index a8e8732053b..1957698c6c1 100644
--- a/app/assets/javascripts/diffs/components/diff_file_header.vue
+++ b/app/assets/javascripts/diffs/components/diff_file_header.vue
@@ -145,6 +145,7 @@ export default {
@click.stop="handleToggle"
/>
<a
+ v-once
ref="titleWrapper"
:href="titleLink"
class="append-right-4"
diff --git a/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue b/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
index a74ea4bfaaf..d5b9f4aa9cf 100644
--- a/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
+++ b/app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
@@ -189,6 +189,7 @@ export default {
</button>
<a
v-if="lineNumber"
+ v-once
:data-linenumber="lineNumber"
:href="lineHref"
>
diff --git a/app/assets/javascripts/diffs/components/diff_table_cell.vue b/app/assets/javascripts/diffs/components/diff_table_cell.vue
index 5b08b161114..bd02b45a63c 100644
--- a/app/assets/javascripts/diffs/components/diff_table_cell.vue
+++ b/app/assets/javascripts/diffs/components/diff_table_cell.vue
@@ -117,14 +117,6 @@ export default {
<template>
<td
- v-if="isContentLine"
- :class="lineType"
- class="line_content"
- v-html="normalizedLine.richText"
- >
- </td>
- <td
- v-else
:class="classNameMap"
>
<diff-line-gutter-content
diff --git a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue
index a2470843ca6..f80915c9abf 100644
--- a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue
+++ b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue
@@ -94,11 +94,12 @@ export default {
:is-hover="isHover"
class="diff-line-num new_line"
/>
- <diff-table-cell
+ <td
+ v-once
:class="line.type"
- :diff-file="diffFile"
- :line="line"
- :is-content-line="true"
- />
+ class="line_content"
+ v-html="line.richText"
+ >
+ </td>
</tr>
</template>
diff --git a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue
index eb769584d74..4202780cd0d 100644
--- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue
+++ b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue
@@ -113,17 +113,15 @@ export default {
:diff-view-type="parallelDiffViewType"
class="diff-line-num old_line"
/>
- <diff-table-cell
+ <td
+ v-once
:id="line.left.lineCode"
- :diff-file="diffFile"
- :line="line"
- :is-content-line="true"
- :line-position="linePositionLeft"
- :line-type="parallelViewLeftLineType"
- :diff-view-type="parallelDiffViewType"
+ :class="parallelViewLeftLineType"
class="line_content parallel left-side"
@mousedown.native="handleParallelLineMouseDown"
- />
+ v-html="line.left.richText"
+ >
+ </td>
<diff-table-cell
:diff-file="diffFile"
:line="line"
@@ -135,16 +133,14 @@ export default {
:diff-view-type="parallelDiffViewType"
class="diff-line-num new_line"
/>
- <diff-table-cell
+ <td
+ v-once
:id="line.right.lineCode"
- :diff-file="diffFile"
- :line="line"
- :is-content-line="true"
- :line-position="linePositionRight"
- :line-type="line.right.type"
- :diff-view-type="parallelDiffViewType"
+ :class="line.right.type"
class="line_content parallel right-side"
@mousedown.native="handleParallelLineMouseDown"
- />
+ v-html="line.right.richText"
+ >
+ </td>
</tr>
</template>