Skip to content

Commit

Permalink
Universe: use Relay 13 and the new Rust Compiler
Browse files Browse the repository at this point in the history
This commit upgrades Relay to version 13 and switches from the old
Relay Compiler to the new Rust one (since both things go together).

Basically, the main change is that now we have only one Relay config
for the whole monorepo and the compiler is being executed for the whole
monorepo as well (while being much faster). Additionally, Relay support
is directly integrated into Flow so in many cases I simply removed
previous Flow types (see `useLazyLoadQuery` and `useFragment`).

There is still ongoing effort to improve the Flow types in Relay so not
everything is finalized. For this reason I decided to use "Compat" types
mode. Similarly, some hooks (`useMutation` and `usePreloadedQuery` for
example) still require explicit types information so I didn't change
these yet. Regardless of that, we are pretty close to use "Final" types.
We just need to wait for the Relay team to finish everything.

Many issues were already resolved but there are still some that need to
be fixed (not blocking this PR):

- facebook/relay#3700
- relayjs/eslint-plugin-relay#131
- prettier/prettier#6102

Important links with additional information:

- https://relay.dev/blog/2021/12/08/introducing-the-new-relay-compiler/
- https://github.com/facebook/relay/releases/tag/v13.0.0
- https://github.com/facebook/relay/releases/tag/v13.0.0-rc.0
- https://github.com/facebook/relay/releases/tag/v13.0.0-rc.1
- https://github.com/facebook/relay/releases/tag/v13.0.0-rc.2

adeira-source-id: bc3d10741250e32b6fd399245f62d25484c6ae70
  • Loading branch information
mrtnzlml authored and adeira-github-bot committed Jan 29, 2022
1 parent b4084d6 commit 979896d
Show file tree
Hide file tree
Showing 19 changed files with 285 additions and 265 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"fbt:manifest": "fbt-manifest --src=src --src=pages --enum-manifest=translations/enum_manifest.json --src-manifest=translations/src_manifest.json",
"fbt:collect": "fbt-collect --options=__self --pretty --manifest < translations/src_manifest.json > translations/source_strings.json",
"fbt:translate": "fbt-translate --source-strings=translations/source_strings.json --pretty --translations translations/in/*.json --output-dir=translations/out --jenkins",
"fbt": "yarn run fbt:manifest && yarn run fbt:collect && yarn run fbt:translate",
"relay": "adeira-relay-compiler"
"fbt": "yarn run fbt:manifest && yarn run fbt:collect && yarn run fbt:translate"
},
"dependencies": {
"@adeira/icons": "^1.0.1",
Expand Down
6 changes: 0 additions & 6 deletions relay.config.js

This file was deleted.

114 changes: 32 additions & 82 deletions src/__generated__/MenuQuery.graphql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/menu/MenuSectionCoffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
};

export default function MenuSectionCoffee(props: Props): Node {
const data = useFragment<MenuSectionCoffee$key>(
const data = useFragment(
graphql`
fragment MenuSectionCoffee on MenuQuery {
coffeeMenu: menu(clientLocale: $clientLocale, section: COFFEE) {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/MenuSectionKochkadaSavory.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
};

export default function MenuSectionKochkadaSavory(props: Props): Node {
const data = useFragment<MenuSectionKochkadaSavory$key>(
const data = useFragment(
graphql`
fragment MenuSectionKochkadaSavory on MenuQuery {
kochkadaSavoryMenu: menu(clientLocale: $clientLocale, section: DUMPLING_SAVORY) {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/MenuSectionKochkadaSweet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
};

export default function MenuSectionKochkadaSweet(props: Props): Node {
const data = useFragment<MenuSectionKochkadaSweet$key>(
const data = useFragment(
graphql`
fragment MenuSectionKochkadaSweet on MenuQuery {
kochkadaSweetMenu: menu(clientLocale: $clientLocale, section: DUMPLING_SWEET) {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/MenuSectionMilkshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
};

export default function MenuSectionMilkshake(props: Props): Node {
const data = useFragment<MenuSectionMilkshake$key>(
const data = useFragment(
graphql`
fragment MenuSectionMilkshake on MenuQuery {
milkshakesMenu: menu(clientLocale: $clientLocale, section: MILKSHAKES) {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/MenuSectionSpecialities.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
};

export default function MenuSectionSpecialities(props: Props): Node {
const data = useFragment<MenuSectionSpecialities$key>(
const data = useFragment(
graphql`
fragment MenuSectionSpecialities on MenuQuery {
specialitiesMenu: menu(clientLocale: $clientLocale, section: SPECIALITIES) {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/MenuSectionTea.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
};

export default function MenuSectionTea(props: Props): Node {
const data = useFragment<MenuSectionTea$key>(
const data = useFragment(
graphql`
fragment MenuSectionTea on MenuQuery {
teaMenu: menu(clientLocale: $clientLocale, section: TEA) {
Expand Down
43 changes: 28 additions & 15 deletions src/menu/__generated__/MenuSectionCoffee.graphql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 28 additions & 15 deletions src/menu/__generated__/MenuSectionKochkadaSavory.graphql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 979896d

Please sign in to comment.