zjk
2026-07-01 7473ed666ba2b154434cfbe360319a52277e10bb
fix: 修改分享目的地不刷新
2个文件已修改
43 ■■■■■ 已修改文件
src/robotaxi/pages/share-trip/hooks/use-map-markers.ts 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/share-trip/hooks/use-share-trip-runtime.ts 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/share-trip/hooks/use-map-markers.ts
@@ -278,7 +278,9 @@
                    buildCarMarkerStructureSignature(prevCar) !== buildCarMarkerStructureSignature(nextCar);
                const latestVehicleLatitude = Number(deps.vehicleLocation?.latitude);
                const latestVehicleLongitude = Number(deps.vehicleLocation?.longitude);
                if (!shouldRefreshCarMarkerStructure && !shouldClearCarRotate) {
                // 车辆在签名中以 'translate' 占位,签名差异只可能来自非车辆 marker(如终点改变)。
                // 因此仅当非车辆 marker 结构未变、车辆结构未变且无需清理朝向时才保留旧 marker,否则必须应用最新 marker。
                if (!shouldRefreshCarMarkerStructure && !shouldClearCarRotate && prevMarkersSignature === nextMarkersSignature) {
                    return prevMarkers;
                }
                mergedMarkers[nextCarIndex] = {
src/robotaxi/pages/share-trip/hooks/use-share-trip-runtime.ts
@@ -57,6 +57,7 @@
  const startSiteRef = useRef<any>(deps.startSite); // 上车点引用
  const endSiteRef = useRef<any>(deps.endSite); // 下车点引用
  const infoStatusRef = useRef<TripStatus | null>(null); // 最新详情状态引用
  const lastRouteIdRef = useRef<string>(''); // 最近一次路线 ID,辅助识别修改目的地后的新路线
  const errorToastShownRef = useRef(false); // 错误提示节流标记
  const applySmoothRouteSnapshotRef = useRef(deps.applySmoothRouteSnapshot); // 平滑快照消费函数引用
@@ -480,6 +481,7 @@
    const applyShareInfo = (info: any) => {
      const mappedStatus = resolveShareTripStatus(info?.status);
      const nextStartSite = buildSite(info, 'start');
      const nextEndSite = buildSite(info, 'end');
      const etaMinutes = Math.max(
@@ -572,12 +574,26 @@
        const routeStatus = resolveRouteOrderStatus(routeResponse);
        const routeEndPoint = extractRouteEndPoint(routeResponse);
        const currentEndSitePoint = normalizePoint(endSiteRef.current);
        // 行程中修改目的地时,订单状态通常不变,因此需要额外通过路线终点变化补拉详情。
        const hasRouteDestinationChanged = (
          !!routeEndPoint
          && !!currentEndSitePoint
          && !isSameCoordinate(routeEndPoint, currentEndSitePoint)
        const routeKey = String(
          getFieldValue(routeResponse?.content?.route, ['routeID', 'routeId'])
          ?? getFieldValue(routeResponse?.content, ['routeID', 'routeId'])
          ?? getFieldValue(routeResponse?.data, ['routeID', 'routeId'])
          ?? getFieldValue(routeResponse, ['routeID', 'routeId'])
          ?? ''
        );
        const hasRouteIdChanged = (
          !!routeKey
          && !!lastRouteIdRef?.current
          && routeKey !== lastRouteIdRef.current
        );
        // 行程中修改目的地时,订单状态通常不变,因此需要额外通过路线终点变化补拉详情。
        // 只要最新路线终点和当前展示的终点 (endSite) 不一致,或者 routeID 变了,就应该持续去拉详情
        const hasRouteDestinationChanged = (
          (!!routeEndPoint && !!currentEndSitePoint && !isSameCoordinate(routeEndPoint, currentEndSitePoint))
          || hasRouteIdChanged
        );
        const shouldFetchInfo = (
          (routeStatus !== null && routeStatus !== infoStatusRef.current)
          || hasRouteDestinationChanged
@@ -609,12 +625,15 @@
        if (mappedStatus === TripStatus.CancelOnlyPickup) {
          applyCanceledTripState(nextStartSite, nextEndSite);
          lastRouteIdRef.current = '';
          stopPolling();
          errorToastShownRef.current = false;
          return false;
        }
        syncShareRoute(routeResponse, mappedStatus, nextStartSite, nextEndSite);
        if (routeKey) lastRouteIdRef.current = routeKey;
        if (mappedStatus >= TripStatus.ArrivedDestination) {
          stopPolling();
          errorToastShownRef.current = false;
@@ -641,6 +660,16 @@
          );
          if (cancelled) return;
          syncShareRoute(routeResponse, infoState.mappedStatus, infoState.nextStartSite, infoState.nextEndSite);
          const routeKey = String(
            getFieldValue(routeResponse?.content?.route, ['routeID', 'routeId'])
            ?? getFieldValue(routeResponse?.content, ['routeID', 'routeId'])
            ?? getFieldValue(routeResponse?.data, ['routeID', 'routeId'])
            ?? getFieldValue(routeResponse, ['routeID', 'routeId'])
            ?? ''
          );
          if (routeKey) lastRouteIdRef.current = routeKey;
          stopPolling();
          errorToastShownRef.current = false;
          return;