Refactor and consolidate store imports (#774)

* Refactor  and consolitdate store imports

- Created a new index file in the core stores directory to export all stores from a single module.
- Updated imports to use consolidated store exports.

* Remove unnecessary import

* Update imports

* Use named exports

* Change store import after merge

---------

Co-authored-by: philon- <philon-@users.noreply.github.com>
This commit is contained in:
Jeremy Gallant
2025-08-11 12:36:33 -04:00
committed by GitHub
co-authored by philon-
parent ed0a99dbd9
commit d453ff809a
81 changed files with 113 additions and 122 deletions
@@ -1,4 +1,4 @@
import { MessageState, MessageType } from "@core/stores/messageStore/index.ts";
import { MessageState, MessageType } from "@core/stores";
import type { Message } from "@core/stores/messageStore/types.ts";
import type { Types } from "@meshtastic/core";
@@ -15,7 +15,7 @@ const mockUpdateFavorite = vi.fn();
const mockGetNode = vi.fn(() => mockNode);
const mockToast = vi.fn();
vi.mock("@core/stores/deviceStore.ts", () => ({
vi.mock("@core/stores", () => ({
useDevice: () => ({
updateFavorite: mockUpdateFavorite,
getNode: mockGetNode,
@@ -1,5 +1,5 @@
import { useToast } from "@core/hooks/useToast.ts";
import { useDevice } from "@core/stores/deviceStore.ts";
import { useDevice } from "@core/stores";
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
@@ -15,7 +15,7 @@ const mockUpdateIgnore = vi.fn();
const mockGetNode = vi.fn(() => mockNode);
const mockToast = vi.fn();
vi.mock("@core/stores/deviceStore.ts", () => ({
vi.mock("@core/stores", () => ({
useDevice: () => ({
updateIgnored: mockUpdateIgnore,
getNode: mockGetNode,
+1 -1
View File
@@ -1,5 +1,5 @@
import { useToast } from "@core/hooks/useToast.ts";
import { useDevice } from "@core/stores/deviceStore.ts";
import { useDevice } from "@core/stores";
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
@@ -2,7 +2,7 @@ import {
useDevice,
type ValidConfigType,
type ValidModuleConfigType,
} from "@core/stores/deviceStore.ts";
} from "@core/stores";
type UseWaitForConfigProps =
| { configCase: ValidConfigType; moduleConfigCase?: never }
@@ -1,6 +1,6 @@
import type { Protobuf } from "@meshtastic/core";
import { vi } from "vitest";
import type { Device } from "./deviceStore.ts";
import type { Device } from "./index.ts";
/**
* You can spread this base mock in your tests and override only the
+22
View File
@@ -0,0 +1,22 @@
export { useAppStore } from "@core/stores/appStore";
export {
type Device,
DeviceContext,
useDevice,
useDeviceStore,
type ValidConfigType,
type ValidModuleConfigType,
} from "@core/stores/deviceStore";
export {
MessageState,
type MessageStore,
MessageType,
useMessageStore,
} from "@core/stores/messageStore";
export {
SidebarProvider,
useSidebar,
} from "@core/stores/sidebarStore";
@@ -13,7 +13,7 @@ import type {
MessageLogMap,
} from "./types.ts";
vi.mock("../storage/indexDB.ts", () => {
vi.mock("../utils/indexDB.ts", () => {
const memoryStorage: Record<string, string> = {};
return {
storageWithMapSupport: {
@@ -1,7 +1,4 @@
import type {
MessageState,
MessageType,
} from "@core/stores/messageStore/index.ts";
import type { MessageState, MessageType } from "@core/stores";
import type { Types } from "@meshtastic/core";
type NodeNum = number;
+1 -2
View File
@@ -1,8 +1,7 @@
import { ensureDefaultUser } from "@core/dto/NodeNumToNodeInfoDTO.ts";
import PacketToMessageDTO from "@core/dto/PacketToMessageDTO.ts";
import type { Device } from "@core/stores/deviceStore.ts";
import { type Device, type MessageStore, MessageType } from "@core/stores";
import { type MeshDevice, Protobuf } from "@meshtastic/core";
import { type MessageStore, MessageType } from "./stores/messageStore/index.ts";
export const subscribeAll = (
device: Device,