mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
planner: the details refresh reads through a repository, and the form drops what moved out
The fresh lookup behind New place details goes through placeDetailsRepo (online-only, like the service identity) instead of api/ directly. The form loses the Translate type and the comment that moved with the head band's pills, which takes it under its line limit and out of the size baseline; the maps service suite's test-size entry follows its shorter count.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { PlaceClientOrigin } from '@trek/shared';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { mapsApi } from '../../api/client';
|
||||
import { placeDetailsRepo } from '../../repo/placeDetailsRepo';
|
||||
import type { Place } from '../../types';
|
||||
import type { PlaceFormData } from './PlaceFormModal.helpers';
|
||||
import { resultOrigin } from './placeFieldOrigins';
|
||||
@@ -34,9 +34,9 @@ export function usePlaceRefresh({
|
||||
useEffect(() => {
|
||||
if (!detailId || !key) return;
|
||||
let live = true;
|
||||
mapsApi.details(detailId, language).then(
|
||||
(answer: { place?: Record<string, unknown> | null }) => {
|
||||
if (live && answer?.place) setFresh({ key, details: answer.place });
|
||||
placeDetailsRepo.details(detailId, language).then(
|
||||
(details) => {
|
||||
if (live && details) setFresh({ key, details });
|
||||
},
|
||||
() => undefined
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user