MCPcopy Create free account
hub / github.com/plotly/dash / describeNativeComponentFrame

Function describeNativeComponentFrame

dash/deps/react@18.2.0.js:1789–1947  ·  view source on GitHub ↗
(fn, construct)

Source from the content-addressed store, hash-verified

1787 }
1788
1789 function describeNativeComponentFrame(fn, construct) {
1790 // If something asked for a stack inside a fake render, it should get ignored.
1791 if ( !fn || reentry) {
1792 return '';
1793 }
1794
1795 {
1796 var frame = componentFrameCache.get(fn);
1797
1798 if (frame !== undefined) {
1799 return frame;
1800 }
1801 }
1802
1803 var control;
1804 reentry = true;
1805 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1806
1807 Error.prepareStackTrace = undefined;
1808 var previousDispatcher;
1809
1810 {
1811 previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1812 // for warnings.
1813
1814 ReactCurrentDispatcher$1.current = null;
1815 disableLogs();
1816 }
1817
1818 try {
1819 // This should throw.
1820 if (construct) {
1821 // Something should be setting the props in the constructor.
1822 var Fake = function () {
1823 throw Error();
1824 }; // $FlowFixMe
1825
1826
1827 Object.defineProperty(Fake.prototype, 'props', {
1828 set: function () {
1829 // We use a throwing setter instead of frozen or non-writable props
1830 // because that won't throw in a non-strict mode function.
1831 throw Error();
1832 }
1833 });
1834
1835 if (typeof Reflect === 'object' && Reflect.construct) {
1836 // We construct a different control for this case to include any extra
1837 // frames added by the construct call.
1838 try {
1839 Reflect.construct(Fake, []);
1840 } catch (x) {
1841 control = x;
1842 }
1843
1844 Reflect.construct(fn, [], Fake);
1845 } else {
1846 try {

Calls 6

disableLogsFunction · 0.70
reenableLogsFunction · 0.70
fnFunction · 0.50
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…