<commit_before>import Ember from 'ember';
import config from 'ember-get-config';

export default Ember.Route.extend({
    theme: Ember.inject.service(),

    init() {
        this.get('store')
            .findAll('preprint-provider', { reload: true })
            .then(data => this.set('providers', data.getEach('id')));
    },

    beforeModel(transition) {
        const {slug} = transition.params.provider;

        if (this.get('providers').includes(slug)) {
            this.set('theme.id', slug);
        } else {
            this.set('theme.id', config.PREPRINTS.provider);

            if (slug.length === 5) {
                this.transitionTo('content', slug);
            } else {
                this.transitionTo('page-not-found');
            }
        }
    },

    actions: {
        error(error) {

            // Manage your errors
            Ember.onerror(error);

            // substate implementation when returning `true`
            return true;

        }
    }
});<commit_msg>Fix race condition in provider route<commit_after>import Ember from 'ember';
import config from 'ember-get-config';

export default Ember.Route.extend({
    theme: Ember.inject.service(),

    beforeModel(transition) {
        const {slug} = transition.params.provider;

        this.get('store')
            .findAll('preprint-provider')
            .then(data => {
                if (data.getEach('id').includes(slug)) {
                    this.set('theme.id', slug);
                } else {
                    this.set('theme.id', config.PREPRINTS.provider);

                    if (slug.length === 5) {
                        this.transitionTo('content', slug);
                    } else {
                        this.transitionTo('page-not-found');
                    }
                }
            });
    },

    actions: {
        error(error) {

            // Manage your errors
            Ember.onerror(error);

            // substate implementation when returning `true`
            return true;

        }
    }
});
{'fraction_non_alphanumeric': 0.1349633251833741, 'fraction_numerical': 0.0009779951100244498, 'mean_word_length': 1.5321782178217822, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3672596', 'n_tokens_mistral': 568, 'n_tokens_neox': 541, 'n_words': 104}