Commit 2b8dc5f
committed
Fix the subtle bug with deprecation warning.
When deprecated `Collaps_a_bleNav` is imported
it also tags `Collaps_i_bleNav` element as deprecated, because
it is done by using pointers which points to the same object.
```js
let CollapsableNav = CollapsibleNav;
CollapsableNav.__deprecated__ = true;
```
https://github.com/react-bootstrap/react-bootstrap/blob/92c57ef7ee/src/CollapsableNav.js#L5
The right and simplest way to make deprecation
in the case of component renaming `CollapsableNav => CollapsibleNav`
by using general for both components part - `classSpecifications`.
Like this:
```js
// NewNameComponent.js
const classSpecificationsFor_NewNameComponent = { /* existing code */ };
const NewNameComponent =
React.createClass( classSpecificationsFor_NewNameComponent );
export {classSpecificationsFor_NewNameComponent}; // for old component
export default NewNameComponent;
// OldNameComponent.js
import {classSpecificationsFor_NewNameComponent} from 'NewNameComponent';
const classSpecsFor_OldNameComponent =
assign({}, classSpecificationsFor_NewNameComponent, {
// here we add deprecation warning
});
const OldNameComponent =
React.createClass( classSpecsFor_OldNameComponent );
export default OldNameComponent;
```1 parent f77c955 commit 2b8dc5f
2 files changed
Lines changed: 19 additions & 16 deletions
File tree
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
4 | 15 | | |
5 | | - | |
| 16 | + | |
6 | 17 | | |
7 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
| 10 | + | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 45 | | |
57 | 46 | | |
58 | 47 | | |
| |||
127 | 116 | | |
128 | 117 | | |
129 | 118 | | |
130 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
131 | 122 | | |
| 123 | + | |
132 | 124 | | |
0 commit comments