-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2024-11-07] Unable to run storybook locally #51108
Comments
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ishpaul777 ( |
Triggered auto assignment to @trjExpensify ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Unable to run storybook locally What is the root cause of that problem?The “cannot access before initialization” error occurs when you try to use a variable before it has been initialized. What changes do you think we should make in order to solve the problem?We should declare and initialize the variable before we use it.
What alternative solutions did you explore? (Optional)N/A Contributor detailsYour Expensify account email: anasup1995@gmail.com |
📣 @Anaslancer! 📣
|
@trjExpensify, @ishpaul777 Whoops! This issue is 2 days overdue. Let's get this updated quick! |
i'll review proposals soon |
Thanks for your proposal @Anaslancer, But I dont think your proposal identifies the root cause of the problem correctly, As I understand, it seems to be case of circular depency in importing of module
|
Thank you, @ishpaul777
So at the moment there is no error, because |
we need to mock the used componenets from realReactNavigation, i am not sure if this is a best way to do this, open to more ideas... diff --git a/__mocks__/@react-navigation/native/index.ts b/__mocks__/@react-navigation/native/index.ts
index 5bcafdc1856..1a56174209e 100644
--- a/__mocks__/@react-navigation/native/index.ts
+++ b/__mocks__/@react-navigation/native/index.ts
@@ -16,9 +16,11 @@ const {triggerTransitionEnd, addListener} = isJestEnv
addListener: () => {},
};
+const realOrMockedUseNavigation = isJestEnv ? realReactNavigation.useNavigation : {};
+
const useNavigation = () => ({
- ...realReactNavigation.useNavigation,
- navigate: jest.fn(),
+ ...realOrMockedUseNavigation,
+ navigate: isJestEnv ? jest.fn() : () => {},
getState: () => ({
routes: [],
}),
@@ -30,17 +32,17 @@ type NativeNavigationMock = typeof ReactNavigation & {
};
export * from '@react-navigation/core';
-const Link = realReactNavigation.Link;
-const LinkingContext = realReactNavigation.LinkingContext;
-const NavigationContainer = realReactNavigation.NavigationContainer;
-const ServerContainer = realReactNavigation.ServerContainer;
-const DarkTheme = realReactNavigation.DarkTheme;
-const DefaultTheme = realReactNavigation.DefaultTheme;
-const ThemeProvider = realReactNavigation.ThemeProvider;
-const useLinkBuilder = realReactNavigation.useLinkBuilder;
-const useLinkProps = realReactNavigation.useLinkProps;
-const useLinkTo = realReactNavigation.useLinkTo;
-const useScrollToTop = realReactNavigation.useScrollToTop;
+const Link = isJestEnv ? realReactNavigation.Link : () => null;
+const LinkingContext = isJestEnv ? realReactNavigation.LinkingContext : () => null;
+const NavigationContainer = isJestEnv ? realReactNavigation.NavigationContainer : () => null;
+const ServerContainer = isJestEnv ? realReactNavigation.ServerContainer : () => null;
+const DarkTheme = isJestEnv ? realReactNavigation.DarkTheme : {};
+const DefaultTheme = isJestEnv ? realReactNavigation.DefaultTheme : {};
+const ThemeProvider = isJestEnv ? realReactNavigation.ThemeProvider : () => null;
+const useLinkBuilder = isJestEnv ? realReactNavigation.useLinkBuilder : () => () => '';
+const useLinkProps = isJestEnv ? realReactNavigation.useLinkProps : () => ({}); |
@ishpaul777 I think it's best solution and it's similar like my above proposal. |
ok lets go with this solution #51108 (comment), lets assign @Anaslancer for PR 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Not really sure where to put this, but I guess being dev related we can put it in #quality. |
LGTM, feel free to create the PR @Anaslancer. |
@chiragsalian I can't not create a pull request from my forked repo's branch to the original repo's staging branch. Is it okay to create to the original repo's main branch? |
Not sure i follow. Like yeah you should not create a PR from your repo to be merged to our repo's staging branch. And yes, creating a PR from your repo to be merged to our repo's main branch is the way to go 🙂 |
@chiragsalian I've just created a pull request. |
@Anaslancer it looks like your PR does not include any changes related to solution it includes unnecessary changes, can you please check again ??
Looks like automation failed here but dont worry BZ team member (@trjExpensify) will take care of this, after 7-days of PR is deployed, you will be hired paid for the job. |
Yep, PR has merged. Once it goes to prod, the 7-day regression period will start. Then payment will be made 👍 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.55-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-11-07. 🎊 For reference, here are some details about the assignees on this issue:
|
@ishpaul777 @trjExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number:
Reproducible in staging?:
Reproducible in production?:
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation: https://expensify.slack.com/archives/C02NK2DQWUX/p1727459623902909
Action Performed:
npm run storybook
Expected Result:
storybook should have opened without any issues
Actual Result:
Bunch of errors locally
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
cc @ishpaul777
Issue Owner
Current Issue Owner: @trjExpensifyThe text was updated successfully, but these errors were encountered: