Commit af6c4bf7 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Remove `paginated_tree_graphql_query` feature flag

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/337214

Changelog: other
parent 969e92bc
...@@ -11,7 +11,6 @@ import { ...@@ -11,7 +11,6 @@ import {
GlIntersectionObserver, GlIntersectionObserver,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { escapeRegExp } from 'lodash'; import { escapeRegExp } from 'lodash';
import filesQuery from 'shared_queries/repository/files.query.graphql';
import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql'; import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql';
import { escapeFileUrl } from '~/lib/utils/url_utility'; import { escapeFileUrl } from '~/lib/utils/url_utility';
import { TREE_PAGE_SIZE } from '~/repository/constants'; import { TREE_PAGE_SIZE } from '~/repository/constants';
...@@ -178,8 +177,7 @@ export default { ...@@ -178,8 +177,7 @@ export default {
return this.isFolder ? this.loadFolder() : this.loadBlob(); return this.isFolder ? this.loadFolder() : this.loadBlob();
}, },
loadFolder() { loadFolder() {
const query = this.glFeatures.paginatedTreeGraphqlQuery ? paginatedTreeQuery : filesQuery; this.apolloQuery(paginatedTreeQuery, {
this.apolloQuery(query, {
projectPath: this.projectPath, projectPath: this.projectPath,
ref: this.ref, ref: this.ref,
path: this.path, path: this.path,
......
<script> <script>
import filesQuery from 'shared_queries/repository/files.query.graphql';
import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql'; import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql';
import createFlash from '~/flash'; import createFlash from '~/flash';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -72,9 +71,6 @@ export default { ...@@ -72,9 +71,6 @@ export default {
hasShowMore() { hasShowMore() {
return !this.clickedShowMore && this.pageLimitReached; return !this.clickedShowMore && this.pageLimitReached;
}, },
paginatedTreeEnabled() {
return this.glFeatures.paginatedTreeGraphqlQuery;
},
}, },
watch: { watch: {
...@@ -101,7 +97,7 @@ export default { ...@@ -101,7 +97,7 @@ export default {
return this.$apollo return this.$apollo
.query({ .query({
query: this.paginatedTreeEnabled ? paginatedTreeQuery : filesQuery, query: paginatedTreeQuery,
variables: { variables: {
projectPath: this.projectPath, projectPath: this.projectPath,
ref: this.ref, ref: this.ref,
...@@ -114,20 +110,19 @@ export default { ...@@ -114,20 +110,19 @@ export default {
if (data.errors) throw data.errors; if (data.errors) throw data.errors;
if (!data?.project?.repository || originalPath !== (this.path || '/')) return; if (!data?.project?.repository || originalPath !== (this.path || '/')) return;
const pageInfo = this.paginatedTreeEnabled const {
? data.project.repository.paginatedTree.pageInfo project: {
: this.hasNextPage(data.project.repository.tree); repository: {
paginatedTree: { pageInfo },
},
},
} = data;
this.isLoadingFiles = false; this.isLoadingFiles = false;
this.entries = Object.keys(this.entries).reduce( this.entries = Object.keys(this.entries).reduce(
(acc, key) => ({ (acc, key) => ({
...acc, ...acc,
[key]: this.normalizeData( [key]: this.normalizeData(key, data.project.repository.paginatedTree.nodes[0][key]),
key,
this.paginatedTreeEnabled
? data.project.repository.paginatedTree.nodes[0][key]
: data.project.repository.tree[key].edges,
),
}), }),
{}, {},
); );
...@@ -149,9 +144,7 @@ export default { ...@@ -149,9 +144,7 @@ export default {
}); });
}, },
normalizeData(key, data) { normalizeData(key, data) {
return this.entries[key].concat( return this.entries[key].concat(data.nodes);
this.paginatedTreeEnabled ? data.nodes : data.map(({ node }) => node),
);
}, },
hasNextPage(data) { hasNextPage(data) {
return [] return []
......
import filesQuery from 'shared_queries/repository/files.query.graphql';
import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql'; import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql';
import projectPathQuery from '../queries/project_path.query.graphql'; import projectPathQuery from '../queries/project_path.query.graphql';
import getRefMixin from './get_ref'; import getRefMixin from './get_ref';
...@@ -22,7 +21,7 @@ export default { ...@@ -22,7 +21,7 @@ export default {
return this.$apollo return this.$apollo
.query({ .query({
query: gon.features.paginatedTreeGraphqlQuery ? paginatedTreeQuery : filesQuery, query: paginatedTreeQuery,
variables: { variables: {
projectPath: this.projectPath, projectPath: this.projectPath,
ref: this.ref, ref: this.ref,
......
...@@ -17,7 +17,6 @@ class Projects::TreeController < Projects::ApplicationController ...@@ -17,7 +17,6 @@ class Projects::TreeController < Projects::ApplicationController
before_action do before_action do
push_frontend_feature_flag(:lazy_load_commits, @project, default_enabled: :yaml) push_frontend_feature_flag(:lazy_load_commits, @project, default_enabled: :yaml)
push_frontend_feature_flag(:paginated_tree_graphql_query, @project, default_enabled: :yaml)
push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml) push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml)
push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml) push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml)
end end
......
...@@ -37,7 +37,6 @@ class ProjectsController < Projects::ApplicationController ...@@ -37,7 +37,6 @@ class ProjectsController < Projects::ApplicationController
push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml) push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml)
push_frontend_feature_flag(:refactor_text_viewer, @project, default_enabled: :yaml) push_frontend_feature_flag(:refactor_text_viewer, @project, default_enabled: :yaml)
push_frontend_feature_flag(:increase_page_size_exponentially, @project, default_enabled: :yaml) push_frontend_feature_flag(:increase_page_size_exponentially, @project, default_enabled: :yaml)
push_frontend_feature_flag(:paginated_tree_graphql_query, @project, default_enabled: :yaml)
push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml) push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml)
end end
......
...@@ -16,8 +16,7 @@ module Types ...@@ -16,8 +16,7 @@ module Types
description: 'Tree of the repository.' description: 'Tree of the repository.'
field :paginated_tree, Types::Tree::TreeType.connection_type, null: true, resolver: Resolvers::PaginatedTreeResolver, calls_gitaly: true, field :paginated_tree, Types::Tree::TreeType.connection_type, null: true, resolver: Resolvers::PaginatedTreeResolver, calls_gitaly: true,
max_page_size: 100, max_page_size: 100,
description: 'Paginated tree of the repository.', description: 'Paginated tree of the repository.'
feature_flag: :paginated_tree_graphql_query
field :blobs, Types::Repository::BlobType.connection_type, null: true, resolver: Resolvers::BlobsResolver, calls_gitaly: true, field :blobs, Types::Repository::BlobType.connection_type, null: true, resolver: Resolvers::BlobsResolver, calls_gitaly: true,
description: 'Blobs contained within the repository' description: 'Blobs contained within the repository'
field :branch_names, [GraphQL::Types::String], null: true, calls_gitaly: true, field :branch_names, [GraphQL::Types::String], null: true, calls_gitaly: true,
......
---
name: paginated_tree_graphql_query
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66751
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/337214
milestone: '14.2'
type: development
group: group::source code
default_enabled: true
...@@ -14012,7 +14012,7 @@ Returns [`[String!]`](#string). ...@@ -14012,7 +14012,7 @@ Returns [`[String!]`](#string).
##### `Repository.paginatedTree` ##### `Repository.paginatedTree`
Paginated tree of the repository. Available only when feature flag `paginated_tree_graphql_query` is enabled. This flag is enabled by default. Paginated tree of the repository.
Returns [`TreeConnection`](#treeconnection). Returns [`TreeConnection`](#treeconnection).
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