Skip to content

Conversation

aTurmo
Copy link
Contributor

@aTurmo aTurmo commented Sep 12, 2025

ref: #TAPC-4569

@@ -0,0 +1,5 @@
import { TVolumeSnapshot } from '@/api/data/snapshot';

export const selectSnapshotForVolume = (volumeId: string) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not simple function with two params ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I can more easilly use it as a mapper in useVolumeSnapshots

export const useVolumeSnapshots = (projectId: string, volumeId: string) => {
  const { data: volume } = useVolume(projectId, volumeId);

  const select = useMemo(
    () => (volume ? selectSnapshotForVolume(volumeId) : undefined),
    [volume],
  );

  return useQuery({
    queryKey: getVolumeSnapshotsQueryKey(projectId, volume?.region),
    queryFn: () => getSnapshotsByRegion(projectId, volume?.region),
    enabled: !!volume,
    select,
  });
};

})}
className={clsx(
displayFieldError &&
'bg-red-100 border-red-500 text-red-500 focus:text-red-500',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to focus text color cause you already have the color without focus

@aTurmo aTurmo force-pushed the feat/TAPC-4569_retyping_snapshots_attached branch from 352e9bd to dbc2202 Compare September 16, 2025 08:11
"pci_projects_project_storages_blocks_retype_detach_volume_label": "Entrer \"{{ confirmWord }}\" pour confirmer votre choix.",
"pci_projects_project_storages_blocks_retype_detach_volume_confirm_button": "Confirmer et continuer",
"pci_projects_project_storages_blocks_retype_detach_volume_error": "Une erreur s'est produite lors du détachement de l'instance. Nous vous invitons à vous rendre sur <0>la page block storage</0> afin de détacher l'instance manuellement"
"pci_projects_project_storages_blocks_retype_detach_volume_error": "Une erreur s'est produite lors du détachement de l'instance. Nous vous invitons à vous rendre sur <0>la page block storage</0> afin de détacher l'instance manuellement.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use another than number tag ? I think they are no encoded very well when you request translation. Especially on fast pass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried with but it doesn't work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

export const useVolumeSnapshots = (projectId: string, volumeId: string) => {
const { data: volume } = useVolume(projectId, volumeId);

const select = useMemo(
Copy link
Contributor

@Tsiorifamonjena Tsiorifamonjena Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestions : How about exit this then the hook can take select as params and if tomorrow you want other use case it will more flexible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because it's integral to the logic of what we are expecting.
When I do "useVolumeSnapshots" i'm expecting to have the snapshots of the corresponding volum and not every snapshot I have (otherwise it would be just "useSnapshot").
So without the select the method doesn't make sense.

And at some point will we have a regionalized api that will do exactly that for us, and the select will go away.

@aTurmo aTurmo force-pushed the feat/TAPC-4569_retyping_snapshots_attached branch from dbc2202 to d7b7b2b Compare September 17, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants