refactor: Introduce granular query types with specific policies for improved caching and data freshness.

This commit is contained in:
pa
2026-03-11 14:37:43 +09:00
parent 14d73b1532
commit a75c4b89f8
23 changed files with 221 additions and 39 deletions

View File

@@ -28,7 +28,7 @@
if (props.hint) {
username.value = props.hint;
} else if (props.userid) {
const args = await queryRequest.fetch('user', { userId: props.userid });
const args = await queryRequest.fetch('user.dialog', { userId: props.userid });
if (args?.json?.displayName) {
username.value = args.json.displayName;
}

View File

@@ -701,7 +701,7 @@
selectedImageUrl: post.imageUrl
};
}
queryRequest.fetch('group', { groupId }).then((args) => {
queryRequest.fetch('group.dialog', { groupId }).then((args) => {
D.groupRef = args.ref;
});
D.visible = true;

View File

@@ -362,7 +362,7 @@ describe('useGroupModerationData', () => {
const { addGroupMemberToSelection } = useGroupModerationData(deps);
await addGroupMemberToSelection('usr_1');
expect(queryRequest.fetch).toHaveBeenCalledWith('user', { userId: 'usr_1' });
expect(queryRequest.fetch).toHaveBeenCalledWith('user.dialog', { userId: 'usr_1' });
expect(deps.selection.setSelectedUsers).toHaveBeenCalledWith('usr_1', expect.objectContaining({
userId: 'usr_1',
displayName: 'Alice'

View File

@@ -492,7 +492,7 @@ export function useGroupModerationData(deps) {
selection.setSelectedUsers(member.userId, member);
return;
}
const userArgs = await queryRequest.fetch('user', { userId });
const userArgs = await queryRequest.fetch('user.dialog', { userId });
member.userId = userArgs.json.id;
member.user = userArgs.json;
member.displayName = userArgs.json.displayName;

View File

@@ -258,7 +258,7 @@
}
if (D.userId) {
queryRequest.fetch('user', { userId: D.userId }).then((args) => {
queryRequest.fetch('user.dialog', { userId: D.userId }).then((args) => {
D.userObject = args.ref;
D.userIds = [D.userId];
});

View File

@@ -129,7 +129,7 @@
}
if (D.userId) {
queryRequest.fetch('user', { userId: D.userId }).then((args) => {
queryRequest.fetch('user.dialog', { userId: D.userId }).then((args) => {
D.userObject = args.ref;
});
}

View File

@@ -99,7 +99,7 @@
(visible) => {
if (visible) {
displayName.value = '';
queryRequest.fetch('user', { userId: sendBoopDialog.value.userId }).then((user) => {
queryRequest.fetch('user.dialog', { userId: sendBoopDialog.value.userId }).then((user) => {
displayName.value = user.ref.displayName;
});
}