Commit 6bef7336 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/fixWeirdSuggestionsState' into 'master'

Fix last diff line not allowing suggestions

See merge request gitlab-org/gitlab!57856
parents cc05b03d 50d80814
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
const diffLines = this.diffFile[INLINE_DIFF_LINES_KEY]; const diffLines = this.diffFile[INLINE_DIFF_LINES_KEY];
let isAdding = false; let isAdding = false;
for (let i = 0, diffLinesLength = diffLines.length - 1; i < diffLinesLength; i += 1) { for (let i = 0, diffLinesLength = diffLines.length - 1; i <= diffLinesLength; i += 1) {
const line = diffLines[i]; const line = diffLines[i];
if (start.line_code === line.line_code) { if (start.line_code === line.line_code) {
......
...@@ -168,6 +168,9 @@ export default { ...@@ -168,6 +168,9 @@ export default {
false, false,
); );
}, },
suggestionsStartIndex() {
return Math.max(this.lines.length - 1, 0);
},
}, },
watch: { watch: {
isSubmitting(isSubmitting) { isSubmitting(isSubmitting) {
...@@ -260,7 +263,7 @@ export default { ...@@ -260,7 +263,7 @@ export default {
:line-content="lineContent" :line-content="lineContent"
:can-suggest="canSuggest" :can-suggest="canSuggest"
:show-suggest-popover="showSuggestPopover" :show-suggest-popover="showSuggestPopover"
:suggestion-start-index="lines.length - 1" :suggestion-start-index="suggestionsStartIndex"
@preview-markdown="showPreviewTab" @preview-markdown="showPreviewTab"
@write-markdown="showWriteTab" @write-markdown="showWriteTab"
@handleSuggestDismissed="() => $emit('handleSuggestDismissed')" @handleSuggestDismissed="() => $emit('handleSuggestDismissed')"
......
...@@ -29,7 +29,7 @@ exports[`Snippet Description Edit component rendering matches the snapshot 1`] = ...@@ -29,7 +29,7 @@ exports[`Snippet Description Edit component rendering matches the snapshot 1`] =
> >
<markdown-header-stub <markdown-header-stub
linecontent="" linecontent=""
suggestionstartindex="-1" suggestionstartindex="0"
/> />
<div <div
......
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