<commit_before>(function () {
    'use strict';

    angular
        .module('atlas')
        .factory('detailReducers', detailReducersFactory);

    detailReducersFactory.$inject = ['ACTIONS'];

    function detailReducersFactory (ACTIONS) {
        var reducers = {};

        reducers[ACTIONS.FETCH_DETAIL.id] = fetchDetailReducer;
        reducers[ACTIONS.SHOW_DETAIL.id] = showDetailReducer;

        return reducers;

        /**
         * @param {Object} oldState
         * @param {String} payload - An API endpoint
         *
         * @returns {Object} newState
         */
        function fetchDetailReducer (oldState, payload) {
            var newState = angular.copy(oldState);

            newState.detail = {
                endpoint: payload,
                reload: Boolean(oldState.detail && oldState.detail.endpoint === payload),
                isLoading: true,
                isFullscreen: payload && payload.includes('catalogus/api')
            };

            newState.map.isLoading = true;
            newState.map.isFullscreen = false;

            newState.layerSelection.isEnabled = false;
            newState.search = null;
            newState.page.name = null;
            newState.straatbeeld = null;
            newState.dataSelection = null;

            return newState;
        }

        /**
         * @param {Object} oldState
         * @param {Object} payload - An object with two variables; display (String) and geometry (GeoJSON).
         *
         * @returns {Object} newState
         */
        function showDetailReducer (oldState, payload) {
            var newState = angular.copy(oldState);

            // Detail can be null if another action gets triggered between FETCH_DETAIL and SHOW_DETAIL
            if (angular.isObject(newState.detail)) {
                newState.detail.display = payload.display;
                newState.detail.geometry = payload.geometry;
                newState.detail.isFullscreen = payload.isFullscreen;

                newState.map.isLoading = false;
                newState.detail.isLoading = false;
                newState.detail.reload = false;
            }

            return newState;
        }
    }
})();<commit_msg>draw state is reet when going to detail page tg-2818<commit_after>(function () {
    'use strict';

    angular
        .module('atlas')
        .factory('detailReducers', detailReducersFactory);

    detailReducersFactory.$inject = ['ACTIONS'];

    function detailReducersFactory (ACTIONS) {
        var reducers = {};

        reducers[ACTIONS.FETCH_DETAIL.id] = fetchDetailReducer;
        reducers[ACTIONS.SHOW_DETAIL.id] = showDetailReducer;

        return reducers;

        /**
         * @param {Object} oldState
         * @param {String} payload - An API endpoint
         *
         * @returns {Object} newState
         */
        function fetchDetailReducer (oldState, payload) {
            var newState = angular.copy(oldState);

            newState.detail = {
                endpoint: payload,
                reload: Boolean(oldState.detail && oldState.detail.endpoint === payload),
                isLoading: true,
                isFullscreen: payload && payload.includes('catalogus/api')
            };

            newState.map.isLoading = true;
            newState.map.isFullscreen = false;

            newState.layerSelection.isEnabled = false;
            newState.search = null;
            newState.page.name = null;
            newState.straatbeeld = null;
            newState.dataSelection = null;

            return newState;
        }

        /**
         * @param {Object} oldState
         * @param {Object} payload - An object with two variables; display (String) and geometry (GeoJSON).
         *
         * @returns {Object} newState
         */
        function showDetailReducer (oldState, payload) {
            var newState = angular.copy(oldState);

            // Detail can be null if another action gets triggered between FETCH_DETAIL and SHOW_DETAIL
            if (angular.isObject(newState.detail)) {
                newState.detail.display = payload.display;
                newState.detail.geometry = payload.geometry;
                newState.detail.isFullscreen = payload.isFullscreen;

                newState.map.isLoading = false;
                newState.map.drawingMode = 'none';

                newState.detail.isLoading = false;
                newState.detail.reload = false;
            }

            return newState;
        }
    }
})();
{'fraction_non_alphanumeric': 0.0960052968439638, 'fraction_numerical': 0.0008828073273008167, 'mean_word_length': 1.7854947756607253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6987023', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1162, 'n_words': 255}