Skip to content

Commit

Permalink
Consume LiveState from relay-runtime root in typegen
Browse files Browse the repository at this point in the history
Reviewed By: tyao1

Differential Revision: D51287605

fbshipit-source-id: f5a9ecf84c88d208a5d7597dcdae96339ea8ce2a
  • Loading branch information
captbaritone authored and facebook-github-bot committed Jan 10, 2024
1 parent 13304c2 commit 2f97f25
Show file tree
Hide file tree
Showing 54 changed files with 100 additions and 124 deletions.
2 changes: 0 additions & 2 deletions compiler/crates/relay-typegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ static LOCAL_3D_PAYLOAD: &str = "Local3DPayload";
static ACTOR_CHANGE_POINT: &str = "ActorChangePoint";
static VALIDATOR_EXPORT_NAME: &str = "validate";
static LIVE_RESOLVERS_LIVE_STATE: &str = "LiveState";
static LIVE_RESOLVERS_EXPERIMENTAL_STORE_PATH: &str =
"relay-runtime/store/experimental-live-resolvers/LiveResolverStore";

lazy_static! {
static ref KEY_CLIENTID: StringKey = "__id".intern();
Expand Down
9 changes: 2 additions & 7 deletions compiler/crates/relay-typegen/src/typegen_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::writer::ExactObject;
use crate::writer::Writer;
use crate::writer::AST;
use crate::KEY_DATA_ID;
use crate::LIVE_RESOLVERS_EXPERIMENTAL_STORE_PATH;
use crate::LIVE_RESOLVERS_LIVE_STATE;
use crate::LOCAL_3D_PAYLOAD;
use crate::RELAY_RUNTIME;
Expand All @@ -42,14 +41,10 @@ pub(crate) struct RuntimeImports {

impl RuntimeImports {
pub(crate) fn write_runtime_imports(&self, writer: &mut Box<dyn Writer>) -> FmtResult {
let mut runtime_import_types = vec![];
if self.resolver_live_state_type {
writer.write_import_type(
&[LIVE_RESOLVERS_LIVE_STATE],
LIVE_RESOLVERS_EXPERIMENTAL_STORE_PATH,
)?;
runtime_import_types.push(LIVE_RESOLVERS_LIVE_STATE);
}

let mut runtime_import_types = vec![];
if self.generic_fragment_type {
runtime_import_types.push(writer.get_runtime_fragment_import())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extend type User {
)
}
==================================== OUTPUT ===================================
import type { LiveState } from "relay-runtime/store/experimental-live-resolvers/LiveResolverStore";
import type { LiveState } from "relay-runtime";
import userPopStarNameResolverType from "PopStarNameResolver";
// Type assertion validating that `userPopStarNameResolverType` resolver is correctly implemented.
// A type error here indicates that the type signature of the resolver module is incorrect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extend type User {
)
}
==================================== OUTPUT ===================================
import type { LiveState } from "relay-runtime/store/experimental-live-resolvers/LiveResolverStore";
import type { LiveState } from "relay-runtime";
import userPopStarNameResolverType from "PopStarNameResolver";
// Type assertion validating that `userPopStarNameResolverType` resolver is correctly implemented.
// A type error here indicates that the type signature of the resolver module is incorrect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extend type User {
)
}
==================================== OUTPUT ===================================
import type { LiveState } from "relay-runtime/store/experimental-live-resolvers/LiveResolverStore";
import type { LiveState } from "relay-runtime";
import type { relayResolver_PopStarNameResolverFragment_name$key } from "relayResolver_PopStarNameResolverFragment_name.graphql";
import userPopStarNameResolverType from "PopStarNameResolver";
// Type assertion validating that `userPopStarNameResolverType` resolver is correctly implemented.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extend type User {
)
}
==================================== OUTPUT ===================================
import type { LiveState } from "relay-runtime/store/experimental-live-resolvers/LiveResolverStore";
import type { LiveState } from "relay-runtime";
import type { relayResolver_PopStarNameResolverFragment_name$key } from "relayResolver_PopStarNameResolverFragment_name.graphql";
import userPopStarNameResolverType from "PopStarNameResolver";
// Type assertion validating that `userPopStarNameResolverType` resolver is correctly implemented.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export type ClientEdgeQuery_relayResolver_Query_me__best_friend = {|
variables: ClientEdgeQuery_relayResolver_Query_me__best_friend$variables,
|};
-------------------------------------------------------------------------------
import type { LiveState } from "relay-runtime/store/experimental-live-resolvers/LiveResolverStore";
import type { DataID } from "relay-runtime";
import type { LiveState, DataID } from "relay-runtime";
import type { relayResolver_BestFriendResolverFragment_name$key } from "relayResolver_BestFriendResolverFragment_name.graphql";
import userBestFriendResolverType from "BestFriendResolver";
// Type assertion validating that `userBestFriendResolverType` resolver is correctly implemented.
Expand Down

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading

0 comments on commit 2f97f25

Please sign in to comment.