Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _force to internal.d.ts #1990

Merged
merged 1 commit into from
Oct 9, 2019
Merged

Add _force to internal.d.ts #1990

merged 1 commit into from
Oct 9, 2019

Conversation

38elements
Copy link
Contributor

No description provided.

constructor: preact.ComponentType<P>;
state: S; // Override Component["state"] to not be readonly for internal use, specifically Hooks
base?: PreactElement;

_dirty: boolean;
_renderCallbacks: Array<() => void>;
_force?: boolean | null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preact/src/component.js

Lines 53 to 70 in cd64450

this._force = false;
if (callback) this._renderCallbacks.push(callback);
enqueueRender(this);
}
};
/**
* Immediately perform a synchronous re-render of the component
* @param {() => void} [callback] A function to be called after component is
* re-rendered
*/
Component.prototype.forceUpdate = function(callback) {
if (this._vnode) {
// Set render mode so that we can differentiate where the render request
// is coming from. We need this because forceUpdate should never call
// shouldComponentUpdate
if (callback) this._renderCallbacks.push(callback);
this._force = true;

preact/src/diff/index.js

Lines 149 to 151 in cd64450

c._force = null;
}

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.2%) to 98.485% when pulling b1100cf on 38elements:patch-1 into cd64450 on preactjs:master.

// this._vnode = null;
// this._nextState = null; // Only class components
// this._processingException = null; // Always read, set only when handling error
// this._pendingError = null; // Always read, set only when handling error. This is used to indicate at diffTime to set _processingException
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is the same role as the type definition.
Therefore, I think it is better that this comment moves to type definition.

Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking this up! You're very prompt in these follow-ups! Much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants