Skip to content

Commit

Permalink
feat(taskQueue): set "async" taskQueue as default
Browse files Browse the repository at this point in the history
Update taskQueue default to "async". Stencil 1 default was "congestionAsync".
  • Loading branch information
adamdbradley committed Aug 4, 2020
1 parent 55331be commit f3bb121
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 11 additions & 0 deletions src/compiler/config/test/validate-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,15 @@ describe('validation', () => {
expect(config.extras.initializeNextTick).toBe(false);
expect(config.extras.tagNameTransform).toBe(false);
});

it('should set taskQueue "async" by default', () => {
const { config } = validateConfig(userConfig);
expect(config.taskQueue).toBe('async');
});

it('should set taskQueue', () => {
userConfig.taskQueue = 'congestionAsync'
const { config } = validateConfig(userConfig);
expect(config.taskQueue).toBe('congestionAsync');
});
});
9 changes: 3 additions & 6 deletions src/compiler/config/validate-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config, ConfigBundle, Diagnostic } from '../../declarations';
import { buildError, buildWarn, isBoolean, isNumber, sortBy } from '@utils';
import { buildError, buildWarn, isBoolean, isNumber, isString, sortBy } from '@utils';
import { setBooleanConfig } from './config-utils';
import { validateDevServer } from './validate-dev-server';
import { validateDistNamespace } from './validate-namespace';
Expand Down Expand Up @@ -58,11 +58,8 @@ export const validateConfig = (userConfig?: Config) => {
setBooleanConfig(config, 'validateTypes', null, !config._isTesting);
setBooleanConfig(config, 'allowInlineScripts', null, true);

if (typeof config.taskQueue !== 'string') {
config.taskQueue = 'congestionAsync';
} else if (config.taskQueue === ('sync' as any)) {
// deprecated 1.12.1
config.taskQueue = 'immediate';
if (!isString(config.taskQueue)) {
config.taskQueue = 'async';
}

// hash file names
Expand Down

0 comments on commit f3bb121

Please sign in to comment.