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

Remove check for sender on channel. #1407

Merged
merged 11 commits into from
Aug 28, 2017

Conversation

Gongreg
Copy link
Member

@Gongreg Gongreg commented Jul 4, 2017

Issue: Because of check for sender in channels library, it is impossible to communicate between manager and addons.

Right now it is only possible to communicate between

  • addons -> provider
  • provider -> manager.

If you want to communicate between manager and addons, you need to send the message from manager to provider and from provider to addons (and vice versa).

What I am afraid about is that I see that this check was added as a separate commit. Could we try to reach @mnmtanish so he could share his knowledge about why he added it in first place?

Also I would really like to get your opinion about this. I thought about adding this check as an opt-out, but @ndelangen feels like we remove the check completely if possible.

What I did

Removed the sender check.

How to test

We need to check out that all addons still work. I feel like this can break someones usage.

@storybookbot
Copy link
Collaborator

storybookbot commented Jul 4, 2017

Fails
🚫

PR is not labeled with one of: ["cleanup","breaking","feature","bug","documentation","maintenance","greenkeeper","other"]

Generated by 🚫 dangerJS

@usulpro
Copy link
Member

usulpro commented Jul 4, 2017

@Gongreg I wonder why do you need to communicate between manager and (panel) addons via the channel? Why you can't use API for that?
I guess we use channel to organize communication with iframe (preview)
Maybe if existing API is not enough we need to add more?

@ndelangen
Copy link
Member

I think this is perfectly understandable.

I'd like the channel to be the event-bus we can just throw events at, and have either side respond.

Sometimes an event is of interest to both the manager and preview.
Having to send an event on 2 different event-busses to get the actions to happen just doesn't make a lot of sense, right?

@codecov
Copy link

codecov bot commented Jul 5, 2017

Codecov Report

Merging #1407 into release/3.3 will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##           release/3.3    #1407   +/-   ##
============================================
  Coverage        23.12%   23.12%           
============================================
  Files              253      253           
  Lines             5756     5756           
  Branches           690      690           
============================================
  Hits              1331     1331           
+ Misses            3928     3920    -8     
- Partials           497      505    +8
Impacted Files Coverage Δ
lib/channels/src/index.js 100% <100%> (ø) ⬆️
addons/knobs/src/components/types/Object.js 5.81% <0%> (ø) ⬆️
...res__/update-addon-info/update-addon-info.input.js 0% <0%> (ø) ⬆️
app/react/src/client/preview/element_check.js 41.17% <0%> (ø) ⬆️
addons/knobs/src/components/types/Number.js 8.06% <0%> (ø) ⬆️
lib/ui/src/modules/ui/containers/layout.js 12.5% <0%> (ø) ⬆️
addons/info/src/components/markdown/htags.js 30% <0%> (ø) ⬆️
addons/knobs/src/components/types/Boolean.js 11.62% <0%> (ø) ⬆️
addons/info/src/components/Node.js 38.88% <0%> (ø) ⬆️
addons/events/src/components/Event.js 0% <0%> (ø) ⬆️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0e468a...3cc763b. Read the comment docs.

@usulpro
Copy link
Member

usulpro commented Jul 5, 2017

is it a breaking change?

@Gongreg
Copy link
Member Author

Gongreg commented Jul 5, 2017

@usulpro, that I am not sure about. It can be breaking change for users
who were using same name events between manager <-> provider and provider <-> addons.

@ndelangen
Copy link
Member

I doubt this is a breaking change actually

@usulpro
Copy link
Member

usulpro commented Jul 5, 2017

I guess "writing-addons" guide encourages to use the one channel ID for addons.
At least Material-UI addon use the same ID for sending and for listening.
So if I understand right it will be broken.
Not sure about other addons... Do we know how many people use it the same way?

@Gongreg
Copy link
Member Author

Gongreg commented Jul 5, 2017

@usulpro, do you mean that they use same event name addon_name/eventName both for communication between manager addons and manager preview?

I mean for it to happen this way they would have to do two emits with same name in different locations.

@ndelangen
Copy link
Member

Can you please fix the unit test that is failing?

@Gongreg
Copy link
Member Author

Gongreg commented Jul 5, 2017

@ndelangen, looks like it is fixed?

@shilman
Copy link
Member

shilman commented Jul 6, 2017

@Gongreg do you mind doing a test pass on the addons in cra-kitchen-sink?

@shilman shilman changed the base branch from master to release/3.3 August 7, 2017 14:08
@thani-sh
Copy link
Contributor

thani-sh commented Aug 7, 2017

Hi @Gongreg
We didn't have any special reasons to add the check. It was just part of the design at that time. If you guys think removing the check (event bus approach) will make things simpler, please go ahead. Just check the code where storybook sends/receives messages a bit.

@ndelangen
Copy link
Member

I did a manual test pass when I approved this @shilman, but I guess example has changed quite a bit, so someone should retest.

Let's get this merged!

@ndelangen ndelangen changed the title [Channels]Remove check for sender. Remove check for sender on channel. Aug 23, 2017
@storybookjs storybookjs deleted a comment from Gongreg Aug 24, 2017
@ndelangen ndelangen added api: addons maintenance User-facing maintenance tasks labels Aug 24, 2017
Copy link
Member

@ndelangen ndelangen left a comment

Choose a reason for hiding this comment

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

Tested, works fine!

@usulpro @tuchk4 If you need help getting your addon compatible, just ask for help on slack, ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants