mirror of
https://github.com/wassname/talk.git
synced 2026-07-28 11:27:05 +08:00
[CORL-260] Bring back sorting (#2186)
* feat: sort stream * feat: add FieldSet component to ui * feat: make accessible and add feature test * test: fix snapshots
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { commitLocalUpdate, Environment } from "relay-runtime";
|
||||
|
||||
import { createMutationContainer, LOCAL_ID } from "talk-framework/lib/relay";
|
||||
|
||||
export interface SetStreamOrderByInput {
|
||||
orderBy:
|
||||
| "CREATED_AT_ASC"
|
||||
| "CREATED_AT_DESC"
|
||||
| "REPLIES_DESC"
|
||||
| "RESPECT_DESC"
|
||||
| "%future added value";
|
||||
}
|
||||
|
||||
export type SetStreamOrderByMutation = (
|
||||
input: SetStreamOrderByInput
|
||||
) => Promise<void>;
|
||||
|
||||
export async function commit(
|
||||
environment: Environment,
|
||||
input: SetStreamOrderByInput
|
||||
) {
|
||||
return commitLocalUpdate(environment, store => {
|
||||
const record = store.get(LOCAL_ID)!;
|
||||
record.setValue(input.orderBy, "streamOrderBy");
|
||||
});
|
||||
}
|
||||
|
||||
export const withSetStreamOrderByMutation = createMutationContainer(
|
||||
"setStreamOrderBy",
|
||||
commit
|
||||
);
|
||||
Reference in New Issue
Block a user