createPage and adding text, first page is coming blank

I have the below JSON

{
“Pages”: [
{
“Text”:“Hi”
},
{
“Text”:“Hello”
}
]
}

I’m looping through it to create the Pages, Frame an d Text. It is working, but the Page 1 is coning blank. “Hi” is getting into Page 2 and “Hello” is getting into Page 3. How do I make it to come in Page 1 and Page 2?

I’m doing something like,

const page = Figma.createPage();
const frame = Figma.createFrame();

// some code here

Figma.currentPage = page;
Figma.currentPage.appendChild(frame);

// some code here

frame.appendChild(text);

Hi there,

Thanks for reaching out. I’m checking this with our internal team. I will get back to you when I have anything I can share with you.

Thanks,
Toku

Every Figma file already comes with an existing page, so the moment you run figma.createPage(), it creates the second page. To fix your code, you should skip calling figma.createPage() until you actually need a second page.