Hey all. First time poster. I’ve recently got an app approved for production and went to test it out and found some weird issues that I didn’t experience at all in dev.
- When I finish installing the app for the first time, it seems like it takes a few minutes for the app to initialize. The app is unresponsive during this time and the message is logged in the console:
Initialization not complete. Please wait.
After 2-3 minutes, and a browser refresh, the app begins to work with no issues.
Here is my initialization function:
let client;
let entity;
let notes;
let isInitialized = false;
let syncTags;
async function init() {
try {
client = await app.initialized();
syncTags = await client.iparams.get('sync_tags');
syncTags = syncTags.sync_tags
entity = client.db.entity({ version: "v1" });
notes = entity.get("noteEntity");
renderNotes()
isInitialized = true;
if (isInitialized === true) {
console.log('App iniitalized!')
}
} catch (error) {
console.error('Error initializing:', error);
}
}
- During the first few minutes another issue comes up where after I send a note, the ticket ID and note ID that is created in the 3rd party system are added to the noteEntity in the apps database. The app widget then renders a link to these notes that are created in the 3rd party app. But after I refresh, the rendered link disappears.
Here is the beginning of the renderNotes function:
async function renderNotes() {
try {
const ticket = await client.data.get('ticket');
const currentNotes = await notes.getAll({
query: {
ticket_id: ticket.ticket.id
}
});
...
}
Let me know if there is any context you need. The weirdest part is after ~5 minutes of being installed, both these issues disappear.