1 | /**
|
2 | * Copyright (c) 2015-present, Facebook, Inc.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | */
|
8 |
|
9 | ;
|
10 |
|
11 | var warning = require('fbjs/lib/warning');
|
12 |
|
13 | function warnNoop(publicInstance, callerName) {
|
14 | if (process.env.NODE_ENV !== 'production') {
|
15 | var constructor = publicInstance.constructor;
|
16 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
|
17 | }
|
18 | }
|
19 |
|
20 | /**
|
21 | * This is the abstract API for an update queue.
|
22 | */
|
23 | var ReactNoopUpdateQueue = {
|
24 | /**
|
25 | * Checks whether or not this composite component is mounted.
|
26 | * @param {ReactClass} publicInstance The instance we want to test.
|
27 | * @return {boolean} True if mounted, false otherwise.
|
28 | * @protected
|
29 | * @final
|
30 | */
|
31 | isMounted: function (publicInstance) {
|
32 | return false;
|
33 | },
|
34 |
|
35 | /**
|
36 | * Enqueue a callback that will be executed after all the pending updates
|
37 | * have processed.
|
38 | *
|
39 | * @param {ReactClass} publicInstance The instance to use as `this` context.
|
40 | * @param {?function} callback Called after state is updated.
|
41 | * @internal
|
42 | */
|
43 | enqueueCallback: function (publicInstance, callback) {},
|
44 |
|
45 | /**
|
46 | * Forces an update. This should only be invoked when it is known with
|
47 | * certainty that we are **not** in a DOM transaction.
|
48 | *
|
49 | * You may want to call this when you know that some deeper aspect of the
|
50 | * component's state has changed but `setState` was not called.
|
51 | *
|
52 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
53 | * `componentWillUpdate` and `componentDidUpdate`.
|
54 | *
|
55 | * @param {ReactClass} publicInstance The instance that should rerender.
|
56 | * @internal
|
57 | */
|
58 | enqueueForceUpdate: function (publicInstance) {
|
59 | warnNoop(publicInstance, 'forceUpdate');
|
60 | },
|
61 |
|
62 | /**
|
63 | * Replaces all of the state. Always use this or `setState` to mutate state.
|
64 | * You should treat `this.state` as immutable.
|
65 | *
|
66 | * There is no guarantee that `this.state` will be immediately updated, so
|
67 | * accessing `this.state` after calling this method may return the old value.
|
68 | *
|
69 | * @param {ReactClass} publicInstance The instance that should rerender.
|
70 | * @param {object} completeState Next state.
|
71 | * @internal
|
72 | */
|
73 | enqueueReplaceState: function (publicInstance, completeState) {
|
74 | warnNoop(publicInstance, 'replaceState');
|
75 | },
|
76 |
|
77 | /**
|
78 | * Sets a subset of the state. This only exists because _pendingState is
|
79 | * internal. This provides a merging strategy that is not available to deep
|
80 | * properties which is confusing. TODO: Expose pendingState or don't use it
|
81 | * during the merge.
|
82 | *
|
83 | * @param {ReactClass} publicInstance The instance that should rerender.
|
84 | * @param {object} partialState Next partial state to be merged with state.
|
85 | * @internal
|
86 | */
|
87 | enqueueSetState: function (publicInstance, partialState) {
|
88 | warnNoop(publicInstance, 'setState');
|
89 | }
|
90 | };
|
91 |
|
92 | module.exports = ReactNoopUpdateQueue; |
\ | No newline at end of file |