Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONData is missing linked columns #1451

Open
kostasb opened this issue Apr 26, 2024 · 0 comments
Open

JSONData is missing linked columns #1451

kostasb opened this issue Apr 26, 2024 · 0 comments
Labels
bug Something isn't working needs-triage

Comments

@kostasb
Copy link
Contributor

kostasb commented Apr 26, 2024

After serializing with toSerializable, restorins types with JSONData does not restore column types under links.

Repro in a schema with two tables A,B where A has a link to B.

import { getXataClient } from "./xata";
import { JSONData } from "@xata.io/client";
import { ARecord } from "./xata";
const xata = getXataClient();

const record = await xata.db.A.select(["*", "B.*"]).getFirst();

console.log(record?.B?.mystrb);

const serializedrecord = record?.toSerializable();

Deserialize(serializedrecord);

function Deserialize(record: JSONData<ARecord>) {
  console.log(record);
  console.log(record?.B?.mystrb);
  return record;
}

Property 'mystrb' does not exist on type 'JSONDataFile | JSONData<Identifiable & { mystrb?: string | null | undefined; } & XataRecord<XataRecord>>'.
Property 'mystrb' does not exist on type 'JSONDataFile'.(2

jdata_links.mov
@kostasb kostasb added the bug Something isn't working label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant