Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Storybook helpers v5 #1714

Merged
merged 4 commits into from
Aug 12, 2019
Merged

Storybook helpers v5 #1714

merged 4 commits into from
Aug 12, 2019

Conversation

ryanmccombe
Copy link
Contributor

@ryanmccombe ryanmccombe commented Aug 9, 2019

Resolves #1668

Overall change: Update service names for parity with Simorgh, and add option to set default service.

Code changes:

  • Renamed indonesian to indonesia.
  • Renamed afaanOromoo to afaanoromoo.
  • inputProvider now allows a default service to be configured, rather than always using news

  • I have assigned myself to this PR and the corresponding issues
  • Tests added for new features
  • Test engineer approval

@ryanmccombe ryanmccombe added simorgh-core-stream ws-media The World Service media stream labels Aug 9, 2019
@ryanmccombe ryanmccombe self-assigned this Aug 9, 2019
@ryanmccombe ryanmccombe marked this pull request as ready for review August 9, 2019 12:36
slots,
componentFunction,
services,
options = {},
Copy link
Contributor

Choose a reason for hiding this comment

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

are we expecting more options? what if this arg was just defaultService = 'news'

Copy link
Contributor

@dr3 dr3 Aug 9, 2019

Choose a reason for hiding this comment

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

Yeah, ide almost prefer

(slots, componentFunction, services)

->

({ slots, componentFunction, services, defaultService })

or put services inside options, as its optional

Copy link
Contributor Author

@ryanmccombe ryanmccombe Aug 9, 2019

Choose a reason for hiding this comment

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

I don't know if we'll need to add more arguments to this eventually, but I think the amount of arguments here is already problematic - you can see that in the test file where there are null parameters being passed in everywhere

Made the 4th an options object to stop the problem getting any further out of hand - https://github.com/ryanmcdermott/clean-code-javascript#function-arguments-2-or-fewer-ideally

Copy link
Contributor Author

@ryanmccombe ryanmccombe Aug 9, 2019

Choose a reason for hiding this comment

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

@dr3 agree that all the arguments should just be one object eventually, but that's a massive breakign change that would require updating all stories in Simorgh and Psammead to a new API. Not sure that's in scope for media pod? We just want our page on storybook 😢

Copy link
Contributor

Choose a reason for hiding this comment

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

@ryanmccombe definitely not in scope for the media pod or this PR really. Could you raise an issue about that refactor though so it can be picked up and looked into by the core pod at a later date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 5.0.0 | [PR#1714](https://github.com/bbc/psammead/pull/1714) Renamed `indonesian` to `indonesia` and `afaanOromoo` to `afaanoromoo`. Input provider now has an optional 4th argument that allows the default service to be configured |
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason you went with 5.0.0 rather than 4.1.0, IMO this doesn't need to be a major change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the service rename part of this is a breaking change - previously, "indonesian" appeared on the dropdown, and got passed to your component if someone selected it. Now, it will be "indonesia"

At least I think that's true - the only thing that makes me doubt it is surely some components would have errored if you passed an invalid service name in the current version?

But maybe nobody noticed it as these services weren't used

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahhh yeah, it is likely those services haven't been used/bugs haven't been spotted.

@ryanmccombe
Copy link
Contributor Author

No testing needed here - just some behind-the-scenes work to add functionality that will be used for future PRs

@ryanmccombe ryanmccombe merged commit f9f1fd6 into latest Aug 12, 2019
@ryanmccombe ryanmccombe deleted the storybook-helpers-v5 branch August 12, 2019 16:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
simorgh-core-stream ws-media The World Service media stream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storybook Input Provider - Incorrect Service Names
5 participants