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

Use client api in react native #3036

Merged
merged 4 commits into from
Feb 20, 2018

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Feb 20, 2018

Issue: RN used the StoryStore from @storybook/core but not the full ClientApi, making things like #2679 difficult

What I did

Refactored a little to use ClientApi

How to test

Test with built-in examples (seems to work). Also try any other apps you can.

Notes

I didn't refactor the ConfigApi out as:
a) it's a pretty small surface area.
b) RN works differently as it doesn't have a redux store or use the same kind of channel logic.

I think we'll be fine leaving that as is.

@tmeasday tmeasday requested review from shilman, igor-dv and a team February 20, 2018 04:44
@tmeasday tmeasday force-pushed the tmeasday/use-client-api-in-react-native branch from 2bcb29c to 7a70d5c Compare February 20, 2018 04:45
Copy link
Member

@danielduan danielduan left a comment

Choose a reason for hiding this comment

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

makes sense to me.

} = {}) {
// channel can be null when running in node
// always check whether channel is available
this._channel = channel;
Copy link
Member

Choose a reason for hiding this comment

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

channel here is only used by RN?

Copy link
Member Author

Choose a reason for hiding this comment

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

This code (client_api) wasn't previously used by RN.

_channel is always there in existing code that uses the client API, but not used by the client API, so given the way I was going to initialize this code in the RN context (without passing the channel as it doesn't exist yet), I figured we get rid of if from this code, so no-one would try and use it in the future.

@codecov
Copy link

codecov bot commented Feb 20, 2018

Codecov Report

Merging #3036 into master will increase coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3036      +/-   ##
==========================================
+ Coverage   37.29%   37.48%   +0.18%     
==========================================
  Files         435      434       -1     
  Lines        9435     9389      -46     
  Branches      923      894      -29     
==========================================
  Hits         3519     3519              
+ Misses       5333     5318      -15     
+ Partials      583      552      -31
Impacted Files Coverage Δ
lib/core/src/client/preview/client_api.js 90.81% <ø> (-1.9%) ⬇️
app/react-native/src/index.js 0% <0%> (ø) ⬆️
app/react-native/src/preview/index.js 0% <0%> (ø) ⬆️
app/react/src/server/utils.js 0% <0%> (-100%) ⬇️
app/vue/src/server/config/babel.js 0% <0%> (-100%) ⬇️
lib/core/src/client/manager/preview.js 0% <0%> (ø) ⬆️
lib/core/src/server/build-static.js 0% <0%> (ø) ⬆️
addons/storysource/src/loader/parse-helpers.js 48.33% <0%> (ø) ⬆️
addons/storyshots/src/rn/loader.js 53.33% <0%> (ø) ⬆️
... and 69 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 b97b07b...f1c1d0c. Read the comment docs.

@Hypnosphi Hypnosphi added maintenance User-facing maintenance tasks react-native core labels Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core maintenance User-facing maintenance tasks react-native
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants