-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when you mix up @LiVe and non-live values.
Reviewed By: alunyov Differential Revision: D37732332 fbshipit-source-id: dc6056a3ba4054c08bc1f7d87a95b8f8b4833d06
- Loading branch information
1 parent
c4dbd26
commit 57f96a1
Showing
6 changed files
with
325 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
packages/react-relay/__tests__/__generated__/LiveResolversTest16Query.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
packages/react-relay/__tests__/__generated__/LiveResolversTest17Query.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
packages/relay-runtime/store/__tests__/resolvers/QueryLiveResolverWithBadReturnValue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow strict-local | ||
* @emails oncall+relay | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* @RelayResolver | ||
* @fieldName live_resolver_with_bad_return_value | ||
* @onType Query | ||
* @live | ||
* | ||
* A @live resolver that does not return a LiveObject | ||
*/ | ||
import type {LiveState} from '../../experimental-live-resolvers/LiveResolverStore'; | ||
|
||
function liveResolverWithBadReturnValue(): LiveState<string> { | ||
// $FlowFixMe The purpose of this resolver is to test a bad return value. | ||
return 'Oops!'; | ||
} | ||
|
||
module.exports = liveResolverWithBadReturnValue; |
34 changes: 34 additions & 0 deletions
34
packages/relay-runtime/store/__tests__/resolvers/QueryNonLiveResolverWithLiveReturnValue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow strict-local | ||
* @emails oncall+relay | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* @RelayResolver | ||
* @fieldName non_live_resolver_with_live_return_value | ||
* @onType Query | ||
* | ||
* A non-@live resolver that returns a LiveObject | ||
*/ | ||
import type {LiveState} from '../../experimental-live-resolvers/LiveResolverStore'; | ||
|
||
function nonLiveResolverWithLiveReturnValue(): LiveState<string> { | ||
return { | ||
read() { | ||
return 'Oops!'; | ||
}, | ||
subscribe(cb) { | ||
return () => {}; | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = nonLiveResolverWithLiveReturnValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters