Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

504 B
Raw Blame
import { useEffect } from 'react';

import { useAuthStore } from '../store/authStore';
import { watchTripAddons } from '../store/tripAddonsStore';

/**
 * Keeps the trip addons of every trip the app looks at live while someone is
 * signed in: the trip owner switching an addon reaches every member at once.
 * Mounted once, by App.
 */
export function useTripAddonsSync(): void {
  const userId = useAuthStore((s) => s.user?.id);
  useEffect(() => (userId ? watchTripAddons() : undefined), [userId]);
}