Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Port#uniqueId a bit more resilient. #929

Closed
wants to merge 1 commit into from

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Jan 29, 2019

Fixes app detection issues introduced in #898 by using a layered fallback system to control the uniqueId:

  • Use name specified in app/app.js (the easiest for users to customize to control how their app is displayed in the inspector)
  • Use modulePrefix specified in app/app.js (all ember-cli apps would have this, and is generally still representative of what each app owner calls their app).
  • Use (unknown app - <RANDOM_GUID>) as a last chance fallback to ensure all detected applications at least show up

Fixes #927

Fixes app detection issues by using a layered fallback system to control
the uniqueId:

* Use `name` specified in `app/app.js` (the easiest for users to
  customize to control how their app is displayed in the inspector)
* Use `modulePrefix` specified in `app/app.js` (all ember-cli apps would
  have this, and is _generally_ still representative of what each app
  owner calls their app).
* Use `(unknown app - <RANDOM_GUID>)` as a last chance fallback to
  ensure **all** detected applications at least show up
@@ -13,8 +13,20 @@ export default EmberObject.extend(Ember.Evented, {
* @property uniqueId
* @type {String}
*/
uniqueId: computed('namespace._application.name', function() {
return this.get('namespace._application.name');
uniqueId: computed('namespace._application.{name,modulePrefix}', 'namespace.applicationId', function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed briefly in Discord, I think this should be an applicationName computed, and we should revert to the old uniqueId generation. We then need to pass both the name and id around and look up the apps by the id somehow, rather than name, I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me @rwwagner90, I'll leave that to you (happy to review and otherwise help out as needed though)...

Copy link
Contributor

@alexhancock alexhancock Jan 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed briefly in Discord, I think this should be an applicationName computed, and we should revert to the old uniqueId generation. We then need to pass both the name and id around and look up the apps by the id somehow, rather than name, I think.

This makes sense to me as well. I was going to leave a comment to this effect after I thought about the idea of doing something like app${randomNum} last night, but then realized that probably wouldn't work for app lookups anymore when switching between apps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexhancock I started trying to do this, but I've been so far unsuccessful. Maybe you could take a look and help get this over the finish line? #930

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexhancock are you on Discord? It would be good to sync up there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I see it now, but I don't have permissions to send messages in the dev-ember-inspector channel

screen shot 2019-01-29 at 11 42 48 am

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heading into a meeting for an hour, but I really only have one question about the changes in #930 so I will just post it here! :P

Why all the changes to the logic in app/port.js and why remove the sendAppList logic?

As far as I can see that code being altered/removed is connected to why populating the list of apps and switching apps no longer works in that changeset. Are the changes born from a desire to clean things up or implement the original app list population logic in a different way?

Happy to help on a revised version of this change after my lunch meeting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexhancock the app list was using the uniqueId and the names as the same thing. We need a reworking of it to support sending both applicationId and applicationName, like the PR is doing. We already have a for loop that loops through the applications, so if we can find a way to use that to populate the apps, that would be ideal. Ping me on discord I am rwwagner90 there as well. I see two alexhancock so I am not sure which is you. You have to go through the #welcome and #setup-profile channels to get permissions to everything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, another option would be to revert my original change, release a new version and then re-introduce the changes once we get the issues resolved.

Not sure how close we feel we are on fixing the issues - I'll leave it up to you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexhancock let's discuss via discord, it will make things quicker

@rwjblue rwjblue closed this Jan 29, 2019
@rwjblue rwjblue deleted the beef-up-unique-id branch January 29, 2019 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v3.5] No longer detects my ember-app
3 participants