rename globalSearch

This commit is contained in:
pa
2026-03-14 20:05:10 +09:00
parent b750d3fb9a
commit 84f46a5645
14 changed files with 51 additions and 51 deletions
@@ -9,7 +9,7 @@ const mocks = vi.hoisted(() => ({
userStore: null
}));
vi.mock('../searchWorker.js?worker', () => ({
vi.mock('../quickSearchWorker.js?worker', () => ({
default: class MockSearchWorker {
constructor() {
this.onmessage = null;
@@ -51,7 +51,7 @@ vi.mock('../../coordinators/groupCoordinator', () => ({
showGroupDialog: (...args) => showGroupDialog(...args)
}));
import { useGlobalSearchStore } from '../globalSearch';
import { useQuickSearchStore } from '../quickSearch';
function setupStores() {
mocks.friendStore = reactive({ friends: new Map() });
@@ -82,7 +82,7 @@ function setupStores() {
mocks.userStore = reactive({ currentUser: { id: 'usr_me' } });
}
describe('useGlobalSearchStore', () => {
describe('useQuickSearchStore', () => {
beforeEach(() => {
vi.clearAllMocks();
mocks.workerInstances.length = 0;
@@ -91,7 +91,7 @@ describe('useGlobalSearchStore', () => {
});
test('discards stale worker results and applies the latest seq only', async () => {
const store = useGlobalSearchStore();
const store = useQuickSearchStore();
store.setQuery('ab');
await nextTick();
@@ -143,7 +143,7 @@ describe('useGlobalSearchStore', () => {
});
test('short query clears results and blocks stale refill', async () => {
const store = useGlobalSearchStore();
const store = useQuickSearchStore();
store.setQuery('ab');
await nextTick();
@@ -172,7 +172,7 @@ describe('useGlobalSearchStore', () => {
});
test('re-dispatches search when currentUserId changes and query is active', async () => {
const store = useGlobalSearchStore();
const store = useQuickSearchStore();
store.setQuery('ab');
await nextTick();
@@ -192,7 +192,7 @@ describe('useGlobalSearchStore', () => {
test('re-dispatches search after index update when query is active', async () => {
vi.useFakeTimers();
const store = useGlobalSearchStore();
const store = useQuickSearchStore();
store.isOpen = true;
await nextTick();
@@ -19,14 +19,14 @@ function setupWorkerHarness() {
};
}
describe('searchWorker message protocol', () => {
describe('quickSearchWorker message protocol', () => {
beforeEach(() => {
vi.resetModules();
});
test('returns empty search result for short query', async () => {
const harness = setupWorkerHarness();
await import('../searchWorker.js');
await import('../quickSearchWorker.js');
harness.dispatch({
type: 'search',
@@ -56,7 +56,7 @@ describe('searchWorker message protocol', () => {
test('deduplicates favorites and joined groups against own results', async () => {
const harness = setupWorkerHarness();
await import('../searchWorker.js');
await import('../quickSearchWorker.js');
harness.dispatch({
type: 'updateIndex',
+3 -3
View File
@@ -17,7 +17,7 @@ import { useGalleryStore } from './gallery';
import { useGameLogStore } from './gameLog';
import { useGameStore } from './game';
import { useGeneralSettingsStore } from './settings/general';
import { useGlobalSearchStore } from './globalSearch';
import { useQuickSearchStore } from './quickSearch';
import { useGroupStore } from './group';
import { useInstanceStore } from './instance';
import { useInviteStore } from './invite';
@@ -167,7 +167,7 @@ export function createGlobalStores() {
charts: useChartsStore(),
dashboard: useDashboardStore(),
modal: useModalStore(),
globalSearch: useGlobalSearchStore()
quickSearch: useQuickSearchStore()
};
}
@@ -208,5 +208,5 @@ export {
useUpdateLoopStore,
useVrcStatusStore,
useModalStore,
useGlobalSearchStore
useQuickSearchStore
};
@@ -8,9 +8,9 @@ import { showWorldDialog } from '../coordinators/worldCoordinator';
import { showAvatarDialog } from '../coordinators/avatarCoordinator';
import { showUserDialog } from '../coordinators/userCoordinator';
import SearchWorker from './searchWorker.js?worker';
import QuickSearchWorker from './quickSearchWorker.js?worker';
export const useGlobalSearchStore = defineStore('GlobalSearch', () => {
export const useQuickSearchStore = defineStore('QuickSearch', () => {
const friendStore = useFriendStore();
const userStore = useUserStore();
const searchIndexStore = useSearchIndexStore();
@@ -25,7 +25,7 @@ export const useGlobalSearchStore = defineStore('GlobalSearch', () => {
function getWorker() {
if (!worker) {
worker = new SearchWorker();
worker = new QuickSearchWorker();
worker.onmessage = handleWorkerMessage;
}
return worker;
+1 -1
View File
@@ -252,7 +252,7 @@ export const useSearchIndexStore = defineStore('SearchIndex', () => {
/**
* Build a snapshot from the internal index maps.
* Used by globalSearch to send data to the Worker.
* Used by quickSearch to send data to the Worker.
* @returns {object} Plain object arrays ready for postMessage.
*/
function getSnapshot() {