[next] Implement Comment History Pagination (#2008)

* refactor: profile

* feat: add pagination to comment history

* feat: add getMeSourceID helper

* feat: update profile in CreateCommentMutation

* fix: clear query response cache on mutation

* test: add integration tests for profile

* test: add unit tests
This commit is contained in:
Kiwi
2018-10-19 17:54:40 +00:00
committed by Wyatt Johnson
parent bc4d746291
commit 2e6237b9d9
27 changed files with 1521 additions and 132 deletions
+5 -4
View File
@@ -1,11 +1,12 @@
import { Environment, ROOT_ID } from "relay-runtime";
import { Environment } from "relay-runtime";
import getMeSourceID from "./getMeSourceID";
export default function getMe(environment: Environment) {
const source = environment.getStore().getSource();
const root = source.get(ROOT_ID)!;
if (!root.me) {
const meID = getMeSourceID(environment);
if (!meID) {
return null;
}
const meID = root.me.__ref;
return source.get(meID)!;
}
@@ -0,0 +1,10 @@
import { Environment, ROOT_ID } from "relay-runtime";
export default function getMeSourceID(environment: Environment): string | null {
const source = environment.getStore().getSource();
const root = source.get(ROOT_ID)!;
if (!root.me) {
return null;
}
return root.me.__ref;
}
@@ -1,3 +1,4 @@
export { default as getMe } from "./getMe";
export { default as getMeSourceID } from "./getMeSourceID";
export { default as getURLWithCommentID } from "./getURLWithCommentID";
export { default as urls } from "./urls";