Commit 06a35867 authored by Phil Hughes's avatar Phil Hughes

Allows for virtual scrolling to be disabled by a URL param

This sets a cookie as well so that future visits will also
be disabled.
parent cef05ad0
......@@ -2,6 +2,7 @@ import Cookies from 'js-cookie';
import Vue from 'vue';
import { mapActions, mapState, mapGetters } from 'vuex';
import { parseBoolean } from '~/lib/utils/common_utils';
import { getParameterValues } from '~/lib/utils/url_utility';
import FindFile from '~/vue_shared/components/file_finder/index.vue';
import eventHub from '../notes/event_hub';
import diffsApp from './components/app.vue';
......@@ -113,6 +114,11 @@ export default function initDiffsApp(store) {
updateDatabase: false,
});
}
const vScrollingParam = getParameterValues('virtual_scrolling')[0];
if (vScrollingParam === 'false' || vScrollingParam === 'true') {
Cookies.set('diffs_virtual_scrolling', vScrollingParam);
}
},
methods: {
...mapActions('diffs', ['setRenderTreeList', 'setShowWhitespace']),
......
import Cookies from 'js-cookie';
import { getParameterValues } from '~/lib/utils/url_utility';
import { __, n__ } from '~/locale';
import {
......@@ -173,7 +174,16 @@ export function suggestionCommitMessage(state, _, rootState) {
});
}
export const isVirtualScrollingEnabled = (state) =>
!state.viewDiffsFileByFile &&
(window.gon?.features?.diffsVirtualScrolling ||
getParameterValues('virtual_scrolling')[0] === 'true');
export const isVirtualScrollingEnabled = (state) => {
const vSrollerCookie = Cookies.get('diffs_virtual_scrolling');
if (vSrollerCookie) {
return vSrollerCookie === 'true';
}
return (
!state.viewDiffsFileByFile &&
(window.gon?.features?.diffsVirtualScrolling ||
getParameterValues('virtual_scrolling')[0] === 'true')
);
};
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