Skip to content

Commit

Permalink
fix(component): only support create() (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
redgeoff authored Aug 8, 2021
1 parent 76ea84c commit 5a5803a
Show file tree
Hide file tree
Showing 84 changed files with 194 additions and 199 deletions.
4 changes: 2 additions & 2 deletions src/actions/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import access from '../access';
export default class Action extends Component {
className = 'Action';

_create(props) {
super._create(props);
create(props) {
super.create(props);

// For mocking
this._registrar = registrar;
Expand Down
8 changes: 4 additions & 4 deletions src/actions/action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ it('should filter by arguments', async () => {
class SetNameAction extends Action {
className = 'SetNameAction';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down Expand Up @@ -463,8 +463,8 @@ it('should fill with customizer', async () => {
const customizer = (obj) => `${obj}bar`;

class FillCustomizedAction extends Action {
_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
name: 'FillCustomizedAction',
Expand Down
4 changes: 2 additions & 2 deletions src/actions/console-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Action from './action';
export default class ConsoleLog extends Action {
className = 'ConsoleLog';

_create(props) {
super._create(props);
create(props) {
super.create(props);

// For mocking
this._console = console;
Expand Down
4 changes: 2 additions & 2 deletions src/actions/create-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class CreateDoc extends Action {
className = 'CreateDoc';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class Email extends Action {
className = 'Email';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/emit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class Emit extends Action {
className = 'Emit';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/generate-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class GenerateComponent extends Action {
className = 'GenerateComponent';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/get-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class GetDoc extends Action {
className = 'GetDoc';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/get-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class GetDocs extends Action {
className = 'GetDocs';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import PropFiller from '../compiler/prop-filler';
export default class Iterator extends Action {
className = 'Iterator';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/java-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import Action from './action';
export default class JavaScript extends Action {
className = 'JavaScript';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/json-stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class JSONStringify extends Action {
className = 'JSONStringify';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/redirect-by-role.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import each from 'lodash/each';
export default class RedirectByRole extends Action {
className = 'RedirectByRole';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class Redirect extends Action {
className = 'Redirect';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/request-password-reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class RequestPasswordReset extends Action {
className = 'RequestPasswordReset';

_create(props) {
super._create(props);
create(props) {
super.create(props);
this._setDefaults(props, { layer: 'backEnd' });
}

Expand Down
4 changes: 2 additions & 2 deletions src/actions/reset-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class ResetPassword extends Action {
className = 'ResetPassword';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class Set extends Action {
className = 'Set';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/snackbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class Snackbar extends Action {
className = 'Snackbar';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/upsert-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Action from './action';
export default class UpsertDoc extends Action {
className = 'UpsertDoc';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/aggregate/record-editor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ let editAccount = null;
let docsCreated = null;

class MockStore extends MemoryStore {
_create(props) {
super._create(props);
create(props) {
super.create(props);

this._docs.set('1', {
id: '1',
Expand Down
4 changes: 2 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import UIComponent from './ui-component';
export default class App extends UIComponent {
className = 'App';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
4 changes: 2 additions & 2 deletions src/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import UIComponent from './ui-component';
export default class Card extends UIComponent {
className = 'Card';

_create(props) {
super._create(props);
create(props) {
super.create(props);
this.set({
schema: {
component: 'Form',
Expand Down
12 changes: 6 additions & 6 deletions src/compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class Compiler {
// need to worry about custom configs for minifiers.
className = className === undefined ? name : className;

_create(props) {
create(props) {
// Use the parentProps and props to fill
const propFiller = new PropFiller(
Object.assign({}, parentProps, props)
Expand All @@ -110,19 +110,19 @@ export class Compiler {
// Remove these properties as they are no longer needed
delete defaultProps.component;

// Instantiate defaultProps. We do this in _create() so that we have a fresh instance of all
// Instantiate defaultProps. We do this in create() so that we have a fresh instance of all
// the child components
self._instantiate(defaultProps);

// props may also contain items that need to be instantiated
self._instantiate(props);

// The default props and props need to be passed to _create() so that parent has a chance to
// act on these props. E.G. componentToWrap needs to be set via _create() before any other
// The default props and props need to be passed to create() so that parent has a chance to
// act on these props. E.G. componentToWrap needs to be set via create() before any other
// action is taken.
const propsAndDefaultProps = Object.assign({}, defaultProps, props);

super._create(propsAndDefaultProps);
super.create(propsAndDefaultProps);

// Are we wrapping a component? Clear the componentToWrap
if (defaultProps.componentToWrap) {
Expand All @@ -131,7 +131,7 @@ export class Compiler {

// Set the defaultProps, which essentially customizes the component based on the
// defaultProps. This would be similar to how you set properties in a
// constructor()/_create() if you were to build the component in JS.
// constructor()/create() if you were to build the component in JS.
this.set(defaultProps);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/compiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ it('should get oldest compiled ancestor', () => {
class FooIt extends Action {
className = 'FooIt';

_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand Down
7 changes: 1 addition & 6 deletions src/component/base-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default class BaseComponent extends events.EventEmitter {
this._setProperty('name', props.name);
}

this._create(props === undefined ? {} : props);
this.create(props === undefined ? {} : props);
this.set(props === undefined ? {} : props);

this._emitCreateIfNotMuted();
Expand Down Expand Up @@ -184,11 +184,6 @@ export default class BaseComponent extends events.EventEmitter {
});
}

// Deprecated: use create instead
_create(props) {
this.create(props);
}

emitChange(name, value) {
this.emit(name, value);
this.emit('$change', name, value);
Expand Down
4 changes: 2 additions & 2 deletions src/component/base-component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import MemoryStore from '../stores/memory-store';
import { PersonFullNameField } from '../fields';

class Song extends BaseComponent {
_create(props) {
super._create(props);
create(props) {
super.create(props);

this._nameSpy = this.get('name');

Expand Down
20 changes: 10 additions & 10 deletions src/component/component.dynamic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { TextField } from '../fields';
import WrappedComponent from './wrapped-component';

class DynamicForm extends Form {
_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
schema: {
Expand All @@ -34,8 +34,8 @@ class DynamicForm extends Form {
}

class DynamicFormExtended extends DynamicForm {
_create(props) {
super._create(
create(props) {
super.create(
Object.assign({}, props, {
firstField: new TextField({
name: 'firstName',
Expand All @@ -47,8 +47,8 @@ class DynamicFormExtended extends DynamicForm {
}

class DynamicCompositionForm extends WrappedComponent {
_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
fields: [
Expand All @@ -61,8 +61,8 @@ class DynamicCompositionForm extends WrappedComponent {
}

class DynamicCompositionComponent extends WrappedComponent {
_create(props) {
super._create(
create(props) {
super.create(
Object.assign({}, props, {
componentToWrap: new DynamicCompositionForm({
componentToWrap: props.baseForm,
Expand Down Expand Up @@ -90,8 +90,8 @@ class DynamicCompositionComponent extends WrappedComponent {
}

class DynamicCompositionExtendedComponent extends DynamicCompositionComponent {
_create(props) {
super._create(props);
create(props) {
super.create(props);

this.set({
fields: [
Expand Down
Loading

0 comments on commit 5a5803a

Please sign in to comment.