mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
[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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user