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

Move from rest-hooks to react-query #11524

Merged
merged 22 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Cypress.Commands.add("initialSetupCompleted", (completed = true) => {
// Modify the workspaces/list response to mark every workspace as "initialSetupComplete" to ensure we're not showing
// the setup/preference page for any workspace if this method got called.
cy.intercept("POST", "/api/v1/workspaces/list", (req) => {
cy.intercept("POST", "/api/v1/workspaces/get", (req) => {
req.continue(res => {
res.body.workspaces = res.body.workspaces.map(ws => ({ ...ws, initialSetupComplete: completed }));
res.body.initialSetupComplete = completed;
res.send(res.body);
});
});
Expand Down
3 changes: 2 additions & 1 deletion airbyte-webapp/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module.exports = {
core: {
builder: 'webpack5',
builder: "webpack5",
},
stories: ["../src/**/*.stories.@(ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app",
"storybook-addon-mock/register",
],
webpackFinal: (config) => {
config.resolve.modules.push(process.cwd() + "/node_modules");
Expand Down
2 changes: 0 additions & 2 deletions airbyte-webapp/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { addDecorator } from "@storybook/react";

import { withProviders } from "./withProvider";
import { MockDecorator } from "./restHooksDecorator";

addDecorator(withProviders);
addDecorator(MockDecorator);

export const parameters = {};
26 changes: 0 additions & 26 deletions airbyte-webapp/.storybook/restHooksDecorator.tsx

This file was deleted.

51 changes: 35 additions & 16 deletions airbyte-webapp/.storybook/withProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from "react";

import { MemoryRouter } from "react-router-dom";
import { IntlProvider } from "react-intl";
import { ThemeProvider } from "styled-components";
import { QueryClientProvider, QueryClient } from "react-query";

// TODO: theme was not working correctly so imported directly
import { theme } from "../src/theme";
Expand All @@ -24,21 +27,37 @@ const AnalyticsContextMock: AnalyticsServiceProviderValue = ({
},
} as unknown) as AnalyticsServiceProviderValue;

const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
suspense: true,
},
},
});

export const withProviders = (getStory) => (
<analyticsServiceContext.Provider value={AnalyticsContextMock}>
<ServicesProvider>
<MemoryRouter>
<IntlProvider messages={messages} locale={"en"}>
<ThemeProvider theme={theme}>
<ConfigServiceProvider defaultConfig={defaultConfig} providers={[]}>
<FeatureService>
<GlobalStyle />
{getStory()}
</FeatureService>
</ConfigServiceProvider>
</ThemeProvider>
</IntlProvider>
</MemoryRouter>
</ServicesProvider>
</analyticsServiceContext.Provider>
<React.Suspense fallback={null}>
<analyticsServiceContext.Provider value={AnalyticsContextMock}>
<QueryClientProvider client={queryClient}>
<ServicesProvider>
<MemoryRouter>
<IntlProvider messages={messages} locale={"en"}>
<ThemeProvider theme={theme}>
<ConfigServiceProvider
defaultConfig={defaultConfig}
providers={[]}
>
<FeatureService>
<GlobalStyle />
{getStory()}
</FeatureService>
</ConfigServiceProvider>
</ThemeProvider>
</IntlProvider>
</MemoryRouter>
</ServicesProvider>
</QueryClientProvider>
</analyticsServiceContext.Provider>
</React.Suspense>
);
Loading