Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-04 15:10:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-04 15:10:30 +0300
commit415f502f73b19e4e7e46d929ded9d64f7e7ee77a (patch)
tree9968494b0f1b0e5b5fc0998d287db0b57c1f823d /app/assets/javascripts/snippets
parenteada495948d07e4a1affffa1fa77bfd9730be1af (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/snippets')
-rw-r--r--app/assets/javascripts/snippets/components/snippet_blob_view.vue9
-rw-r--r--app/assets/javascripts/snippets/index.js8
-rw-r--r--app/assets/javascripts/snippets/mixins/snippets.js15
3 files changed, 15 insertions, 17 deletions
diff --git a/app/assets/javascripts/snippets/components/snippet_blob_view.vue b/app/assets/javascripts/snippets/components/snippet_blob_view.vue
index 27b3a30b40a..8481ac2b9c9 100644
--- a/app/assets/javascripts/snippets/components/snippet_blob_view.vue
+++ b/app/assets/javascripts/snippets/components/snippet_blob_view.vue
@@ -29,15 +29,6 @@ export default {
update(data) {
return this.onContentUpdate(data);
},
- result() {
- if (this.activeViewerType === RICH_BLOB_VIEWER) {
- // eslint-disable-next-line vue/no-mutating-props
- this.blob.richViewer.renderError = null;
- } else {
- // eslint-disable-next-line vue/no-mutating-props
- this.blob.simpleViewer.renderError = null;
- }
- },
skip() {
return this.viewer.renderError;
},
diff --git a/app/assets/javascripts/snippets/index.js b/app/assets/javascripts/snippets/index.js
index 789332ce5b7..576bfe87561 100644
--- a/app/assets/javascripts/snippets/index.js
+++ b/app/assets/javascripts/snippets/index.js
@@ -14,7 +14,13 @@ export default function appFactory(el, Component) {
}
const apolloProvider = new VueApollo({
- defaultClient: createDefaultClient({}, { batchMax: 1 }),
+ defaultClient: createDefaultClient(
+ {},
+ {
+ batchMax: 1,
+ assumeImmutableResults: true,
+ },
+ ),
});
const {
diff --git a/app/assets/javascripts/snippets/mixins/snippets.js b/app/assets/javascripts/snippets/mixins/snippets.js
index 7552eae97fc..b72befef56b 100644
--- a/app/assets/javascripts/snippets/mixins/snippets.js
+++ b/app/assets/javascripts/snippets/mixins/snippets.js
@@ -1,3 +1,4 @@
+import { isEmpty } from 'lodash';
import GetSnippetQuery from 'shared_queries/snippet/snippet.query.graphql';
const blobsDefault = [];
@@ -12,20 +13,18 @@ export const getSnippetMixin = {
};
},
update(data) {
- const res = data.snippets.nodes[0];
+ const res = { ...data.snippets.nodes[0] };
// Set `snippet.blobs` since some child components are coupled to this.
- if (res) {
+ if (!isEmpty(res)) {
// It's possible for us to not get any blobs in a response.
// In this case, we should default to current blobs.
- res.blobs = res.blobs ? res.blobs.nodes : this.blobs;
+ res.blobs = res.blobs ? res.blobs.nodes : blobsDefault;
+ res.description = res.description || '';
}
return res;
},
- result(res) {
- this.blobs = res.data.snippets.nodes[0]?.blobs || blobsDefault;
- },
skip() {
return this.newSnippet;
},
@@ -41,12 +40,14 @@ export const getSnippetMixin = {
return {
snippet: {},
newSnippet: !this.snippetGid,
- blobs: blobsDefault,
};
},
computed: {
isLoading() {
return this.$apollo.queries.snippet.loading;
},
+ blobs() {
+ return this.snippet?.blobs || [];
+ },
},
};