Commit 239789d5 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'tz-remove-startup-css-feature-flag' into 'master'

Removes the Startup_CSS Feature flag

See merge request gitlab-org/gitlab!50831
parents f687431e 6016a1d9
...@@ -22,7 +22,7 @@ const handleStartupEvents = () => { ...@@ -22,7 +22,7 @@ const handleStartupEvents = () => {
/* For `waitForCSSLoaded` methods, see docs.gitlab.com/ee/development/fe_guide/performance.html#important-considerations */ /* For `waitForCSSLoaded` methods, see docs.gitlab.com/ee/development/fe_guide/performance.html#important-considerations */
export const waitForCSSLoaded = (action = () => {}) => { export const waitForCSSLoaded = (action = () => {}) => {
if (!gon?.features?.startupCss || allLinksLoaded()) { if (allLinksLoaded()) {
return new Promise((resolve) => { return new Promise((resolve) => {
action(); action();
resolve(); resolve();
......
...@@ -4,8 +4,6 @@ require 'digest/md5' ...@@ -4,8 +4,6 @@ require 'digest/md5'
require 'uri' require 'uri'
module ApplicationHelper module ApplicationHelper
include StartupCssHelper
# See https://docs.gitlab.com/ee/development/ee_features.html#code-in-appviews # See https://docs.gitlab.com/ee/development/ee_features.html#code-in-appviews
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
# We allow partial to be nil so that collection views can be passed in # We allow partial to be nil so that collection views can be passed in
...@@ -250,11 +248,7 @@ module ApplicationHelper ...@@ -250,11 +248,7 @@ module ApplicationHelper
end end
def stylesheet_link_tag_defer(path) def stylesheet_link_tag_defer(path)
if use_startup_css? stylesheet_link_tag(path, media: "print", crossorigin: ActionController::Base.asset_host ? 'anonymous' : nil)
stylesheet_link_tag(path, media: "print", crossorigin: ActionController::Base.asset_host ? 'anonymous' : nil)
else
stylesheet_link_tag(path, media: "all")
end
end end
def outdated_browser? def outdated_browser?
......
# frozen_string_literal: true
module StartupCssHelper
def use_startup_css?
(Feature.enabled?(:startup_css) || params[:startup_css] == 'true' || cookies['startup_css'] == 'true') && !Rails.env.test?
end
end
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
= stylesheet_link_tag_defer "application" = stylesheet_link_tag_defer "application"
= yield :page_specific_styles = yield :page_specific_styles
= stylesheet_link_tag_defer "application_utilities" = stylesheet_link_tag_defer "application_utilities"
- unless use_startup_css?
= stylesheet_link_tag_defer "themes/#{user_application_theme_css_filename}" if user_application_theme_css_filename
= stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations'] = stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations']
= stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}" = stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}"
......
- return unless use_startup_css?
- startup_filename = current_path?("sessions#new") ? 'signin' : user_application_theme == 'gl-dark' ? 'dark' : 'general' - startup_filename = current_path?("sessions#new") ? 'signin' : user_application_theme == 'gl-dark' ? 'dark' : 'general'
%style{ type: "text/css" } %style{ type: "text/css" }
......
- return unless use_startup_css?
= javascript_tag do = javascript_tag do
:plain :plain
document.querySelectorAll('link[media="print"]').forEach(linkTag => { document.querySelectorAll('link[media="print"]').forEach(linkTag => {
......
---
name: startup_css
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39713
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238718
milestone: '13.3'
type: development
group: group::editor
default_enabled: false
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
module Gitlab module Gitlab
module GonHelper module GonHelper
include StartupCssHelper
include WebpackHelper include WebpackHelper
def add_gon_variables def add_gon_variables
...@@ -49,9 +48,6 @@ module Gitlab ...@@ -49,9 +48,6 @@ module Gitlab
push_frontend_feature_flag(:usage_data_api, default_enabled: true) push_frontend_feature_flag(:usage_data_api, default_enabled: true)
push_frontend_feature_flag(:security_auto_fix, default_enabled: false) push_frontend_feature_flag(:security_auto_fix, default_enabled: false)
push_frontend_feature_flag(:gl_tooltips, default_enabled: :yaml) push_frontend_feature_flag(:gl_tooltips, default_enabled: :yaml)
# Startup CSS feature is a special one as it can be enabled by means of cookies and params
gon.push({ features: { 'startupCss' => use_startup_css? } }, true)
end end
# Exposes the state of a feature flag to the frontend code. # Exposes the state of a feature flag to the frontend code.
......
...@@ -39,24 +39,7 @@ describe('waitForCSSLoaded', () => { ...@@ -39,24 +39,7 @@ describe('waitForCSSLoaded', () => {
}); });
}); });
describe('with startup css disabled', () => {
gon.features = {
startupCss: false,
};
it('should invoke the action right away', async () => {
const events = waitForCSSLoaded(mockedCallback);
await events;
expect(mockedCallback).toHaveBeenCalledTimes(1);
});
});
describe('with startup css enabled', () => { describe('with startup css enabled', () => {
gon.features = {
startupCss: true,
};
it('should dispatch CSSLoaded when the assets are cached or already loaded', async () => { it('should dispatch CSSLoaded when the assets are cached or already loaded', async () => {
setFixtures(` setFixtures(`
<link href="one.css" data-startupcss="loaded"> <link href="one.css" data-startupcss="loaded">
......
...@@ -59,7 +59,7 @@ RSpec.describe 'layouts/_head' do ...@@ -59,7 +59,7 @@ RSpec.describe 'layouts/_head' do
render render
expect(rendered).to match('<link rel="stylesheet" media="all" href="/stylesheets/highlight/themes/solarised-light.css" />') expect(rendered).to match('<link rel="stylesheet" media="print" href="/stylesheets/highlight/themes/solarised-light.css" />')
end end
context 'when an asset_host is set and snowplow url is set' do context 'when an asset_host is set and snowplow url is set' do
......
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