question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Renaming causes bug to occur on iOS device

See original GitHub issue

The following JavaScript

"use strict";
const selectors_1 = require("../../../shared/selectors");
module.exports = async (dispatch, getState, { match, serverRes, appContext }) => {
    const { fetchProjectDetails } = await appContext.import('../actions', __filename, __dirname);
    await dispatch(fetchProjectDetails(match.params.projectHId));
    if (typeof process !== 'undefined') {
        if (selectors_1.getRequestErrorCode(getState(), { operationId: `/projects/${match.params.projectHId}` }) === 'NOT_FOUND') {
            serverRes && serverRes.status(404);
        }
    }
};

Compiled like this

java -jar closure-compiler-v20181125.jar --language_in ECMASCRIPT_2017 --language_out ECMASCRIPT_2017 --js x.js --formatting PRETTY_PRINT

Results in the following code

'use strict';
const selectors_1 = require("../../../shared/selectors");
module.exports = async(d, e, {match:b, serverRes:c, appContext:a}) => {
  var {fetchProjectDetails:a} = await a.import("../actions", __filename, __dirname);
  await d(a(b.params.projectHId));
  "undefined" !== typeof process && "NOT_FOUND" === selectors_1.getRequestErrorCode(e(), {operationId:`/projects/${b.params.projectHId}`}) && c && c.status(404);
};

This line

var {fetchProjectDetails:a} = await a.import("../actions", __filename, __dirname);

Both appContext and fetchProjectDetails was renamed to a which appears to confuse iOS. The error we get is undefined is not an object (evaluating 'a.import'). This is a consistent issue across all iOS devices we’ve been able to test with and I’m wondering whether there’s a way to get around this issue without switching to WHITESPACE_ONLY.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lauraharkercommented, Dec 20, 2018

One more debugging item I forgot about earlier:

If you enable options.generatePseudoNames = true, the compiler will generate a new name that fuses the two combined variable names, instead of just using the first name. Something like: function f(a) { let b = 3; return b; } -> function f(a_b) { let a_b = 3; return a_b; }

0reactions
leidegrecommented, Dec 19, 2018

I agree that this makes debugging harder. Since it benefits code size it still seems worth having on by default to me. (As long as the source map information is corret.)

Agreed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iPhone renaming itself | MacRumors Forums
I seem to have a strange issue where my phone keeps renaming itself. I usually keep the name of my phone the default...
Read more >
iPhone 12 is constantly renaming itself - Apple Community
iPhone 12 is constantly renaming itself. Hi, I have iOS 15.4.1 and recently found when my phone pairs to my car the is...
Read more >
Why does an iPhone rename itself with (2) - Ask Different
That occurs when your Wifi network, or another Wifi network he's been connected to, think that there are two devices with the same...
Read more >
Xcode - renaming project causes problem - Stack Overflow
Open the Project Navigator Click on the project name at the top of the tree, tap again and rename box should appear Review...
Read more >
iOS Mobile_app lost name for unknown reason - HA confused ...
As I have a LOT of automatons that now all break I tried renaming it back. I renamed the device under the “mobile...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found