<commit_before>export default RegionSelection = {};

/** List of routes that show different results when the region changes.
  */
RegionSelection.regionDependentRoutes =
	['home', 'find', 'calendar', 'venueMap'];

/** Subscribe to list of regions and configure the regions
  * This checks client storage for a region setting. When there is no previously
  * selected region, we ask the server to do geolocation. If that fails too,
  * we just set the region to 'all regions'. */
RegionSelection.init = function() {
	var selectors =
		[ Session.get('region') // The region might have been chosen already because the user is logged-in. See Accounts.onLogin().
		, UrlTools.queryParam('region')
		, localStorage.getItem('region')
		].filter(Boolean);

	// When the region is not provided we show a splash screen
	Session.set('showRegionSplash', selectors.length < 1);

	Meteor.subscribe('regions', function() {
		var useAsRegion = function(regionId) {<commit_msg>prevent race condition for user region stored in session var<commit_after>export default RegionSelection = {};

/** List of routes that show different results when the region changes.
  */
RegionSelection.regionDependentRoutes =
	['home', 'find', 'calendar', 'venueMap'];

/** Subscribe to list of regions and configure the regions
  * This checks client storage for a region setting. When there is no previously
  * selected region, we ask the server to do geolocation. If that fails too,
  * we just set the region to 'all regions'. */
RegionSelection.init = function() {
	var selectors =
		[ UrlTools.queryParam('region')
		, localStorage.getItem('region')
		].filter(Boolean);

	Tracker.autorun(function() {
		const user = Meteor.user();

		if (user) {
			// The region might have been chosen already because the user is logged-in.
			// See Accounts.onLogin().
			selectors.unshift(Session.get('region'));
		}

		if (user !== undefined) {
			// When the region is not provided we show a splash screen
			Session.set('showRegionSplash', selectors.length < 1);
		}
	});

	Meteor.subscribe('regions', function() {
		var useAsRegion = function(regionId) {
{'fraction_non_alphanumeric': 0.11200378071833648, 'fraction_numerical': 0.000945179584120983, 'mean_word_length': 4.176039119804401, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7190023', 'n_tokens_mistral': 616, 'n_tokens_neox': 577, 'n_words': 224}