Skip to content

Commit c9e6ea2

Browse files
committed
Remove deprecated instance methods & clearInstanceIdCounters
BREAKING CHANGE: These deprectated methods & function have been removed: - this.LifecyclePanel (replaced by this.props.LifecyclePanel) - this.trace (replaced by this.props.trace) - clearInstanceIdCounters (replaced by resetInstanceIdCounters)
1 parent 567bd99 commit c9e6ea2

File tree

5 files changed

+5
-115
lines changed

5 files changed

+5
-115
lines changed

src/constants.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,3 @@ export const lifecycleMethodNamesLegacyOnly =
5656

5757
const sessionStorageKey = '@@react-lifecycle-visualizer--persistent-state:';
5858
export const sessionReplayTimerDelayKey = sessionStorageKey + 'replayTimerDelay';
59-
60-
export const DEPRECATED_THIS_LIFECYCLE_PANEL = 'DEPRECATED_THIS_LIFECYCLE_PANEL';
61-
export const DEPRECATED_THIS_TRACE = 'DEPRECATED_THIS_TRACE';
62-
export const DEPRECATED_CLEAR_COUNTERS = 'DEPRECATED_CLEAR_COUNTERS';

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import './react-lifecycle-visualizer.scss';
22
import Log from './components/Log';
3-
import traceLifecycle, { clearInstanceIdCounters, resetInstanceIdCounters } from './traceLifecycle';
3+
import traceLifecycle, { resetInstanceIdCounters } from './traceLifecycle';
44
import VisualizerProvider, { clearLog } from './redux/VisualizerProvider';
55

6-
export { clearInstanceIdCounters, clearLog, Log, resetInstanceIdCounters, traceLifecycle, VisualizerProvider };
6+
export { clearLog, Log, resetInstanceIdCounters, traceLifecycle, VisualizerProvider };

src/traceLifecycle.jsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import hoistStatics from 'hoist-non-react-statics';
44

55
import * as constants from './constants';
66
import * as ActionCreators from './redux/actionCreators';
7-
import { withDeprecationWarning } from './util';
87
import LifecyclePanel from './components/LifecyclePanel';
98
import { MConstructor, MShouldUpdate, MRender, MDidMount,
109
MDidUpdate, MWillUnmount, MSetState, MGetDerivedState, MGetSnapshot,
@@ -18,11 +17,6 @@ export const resetInstanceIdCounters = () => {
1817
Object.keys(instanceIdCounters).forEach((k) => delete instanceIdCounters[k]);
1918
};
2019

21-
export const clearInstanceIdCounters = withDeprecationWarning(
22-
constants.DEPRECATED_CLEAR_COUNTERS,
23-
resetInstanceIdCounters
24-
);
25-
2620
const mkInstanceId = (componentName) => {
2721
if (!Object.prototype.hasOwnProperty.call(instanceIdCounters, componentName)) {
2822
instanceIdCounters[componentName] = 0;
@@ -48,14 +42,6 @@ export default function traceLifecycle(ComponentToTrace) {
4842
constructor(props, context) {
4943
props.trace(MConstructor);
5044
super(props, context);
51-
this.LifecyclePanel = withDeprecationWarning(
52-
constants.DEPRECATED_THIS_LIFECYCLE_PANEL,
53-
props.LifecyclePanel
54-
);
55-
this.trace = withDeprecationWarning(
56-
constants.DEPRECATED_THIS_TRACE,
57-
props.trace
58-
);
5945
if (!isLegacy && typeof this.state === 'undefined') {
6046
this.state = {};
6147
// Initialize state if it is undefined, otherwise the addition of getDerivedStateFromProps will cause a warning.

src/util.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as constants from './constants';
2-
31
export const padZeroes = (width, n) => ('' + n).padStart(width, '0');
42

53
export const getTimeStamp = () => {
@@ -14,15 +12,9 @@ export const withDeprecationWarning = (warningLabel, fn) => (...args) => {
1412
if (!shownWarningLabels.includes(warningLabel)) {
1513
let message;
1614
switch (warningLabel) {
17-
case constants.DEPRECATED_THIS_LIFECYCLE_PANEL:
18-
message = 'this.LifecyclePanel is deprecated, please use this.props.LifecyclePanel instead.';
19-
break;
20-
case constants.DEPRECATED_THIS_TRACE:
21-
message = 'this.trace is deprecated, please use this.props.trace instead.';
22-
break;
23-
case constants.DEPRECATED_CLEAR_COUNTERS:
24-
message = 'clearInstanceIdCounters() is deprecated, please use resetInstanceIdCounters() instead.';
25-
break;
15+
// case constants.DEPRECATED_DEPRECATED_FEATURE:
16+
// message = 'DEPRECATED_FEATURE is deprecated, please use FEATURE instead.';
17+
// break;
2618
default:
2719
message = 'Unspecified warning.';
2820
}

test/deprecation.test.jsx

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)