fix: Convert location ID to integer for Locations_by_pk query
Root cause: Next.js URL params are always strings, but Locations.id is integer in PostgreSQL. Hasura/PostgreSQL cannot compare varchar with integer without explicit cast. Fix: Parse params.id to integer in LocationsDetail component before passing to Refine useOne().
This commit is contained in:
@@ -28,11 +28,12 @@ type LocationDetailProps = {
|
|||||||
|
|
||||||
export const LocationsDetail = ({ params }: LocationDetailProps) => {
|
export const LocationsDetail = ({ params }: LocationDetailProps) => {
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
const numericId = parseInt(id, 10);
|
||||||
const {
|
const {
|
||||||
query: { data, isLoading },
|
query: { data, isLoading },
|
||||||
} = useOne<LocationDto>({
|
} = useOne<LocationDto>({
|
||||||
resource: ResourceType.LOCATIONS,
|
resource: ResourceType.LOCATIONS,
|
||||||
id,
|
id: numericId,
|
||||||
meta: {
|
meta: {
|
||||||
gqlQuery: LOCATIONS_GET_QUERY,
|
gqlQuery: LOCATIONS_GET_QUERY,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user