attempt to fix iframe issues in production
This commit is contained in:
+16
-16
@@ -1058,8 +1058,8 @@ export const initStore = async () => {
|
|||||||
// await syncSystemTagsAndRules();
|
// await syncSystemTagsAndRules();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fire off background sync after a short delay
|
// Fire off background sync
|
||||||
setTimeout(backgroundSync, 100);
|
await backgroundSync();
|
||||||
|
|
||||||
// Separate Templates load (less critical)
|
// Separate Templates load (less critical)
|
||||||
try {
|
try {
|
||||||
@@ -1548,7 +1548,7 @@ export const upsertTagDefinition = async (name: string, value: number, color?: s
|
|||||||
value,
|
value,
|
||||||
color: color || "#6366f1", // Default indigo
|
color: color || "#6366f1", // Default indigo
|
||||||
theme: finalTheme
|
theme: finalTheme
|
||||||
});
|
}, { requestKey: null });
|
||||||
|
|
||||||
const newDef: TagDefinition = {
|
const newDef: TagDefinition = {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
@@ -1636,7 +1636,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
color: bucket.color || "#64748b",
|
color: bucket.color || "#64748b",
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
isBucket: true
|
isBucket: true
|
||||||
});
|
}, { requestKey: null });
|
||||||
setStore("tagDefinitions", prev => [...prev, {
|
setStore("tagDefinitions", prev => [...prev, {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
name: record.name,
|
name: record.name,
|
||||||
@@ -1650,7 +1650,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
}
|
}
|
||||||
} else if (!tagExistsExact.isBucket) {
|
} else if (!tagExistsExact.isBucket) {
|
||||||
try {
|
try {
|
||||||
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isBucket: true });
|
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isBucket: true }, { requestKey: null });
|
||||||
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isBucket: true });
|
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isBucket: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Failed to flag tag ${bucketTagName} as bucket`, e);
|
console.error(`Failed to flag tag ${bucketTagName} as bucket`, e);
|
||||||
@@ -1673,7 +1673,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
if (bucketRuleLegacy && !bucketRuleExact) {
|
if (bucketRuleLegacy && !bucketRuleExact) {
|
||||||
// Rename legacy rule
|
// Rename legacy rule
|
||||||
try {
|
try {
|
||||||
await pb.collection(SHARE_RULES_COLLECTION).update(bucketRuleLegacy.id, { tagName: bucketTagName });
|
await pb.collection(SHARE_RULES_COLLECTION).update(bucketRuleLegacy.id, { tagName: bucketTagName }, { requestKey: null });
|
||||||
setStore("shareRules", r => r.id === bucketRuleLegacy.id, { tagName: bucketTagName });
|
setStore("shareRules", r => r.id === bucketRuleLegacy.id, { tagName: bucketTagName });
|
||||||
console.log(`Renamed legacy bucket rule: ${bucket.name} -> ${bucketTagName}`);
|
console.log(`Renamed legacy bucket rule: ${bucket.name} -> ${bucketTagName}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1687,7 +1687,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
type: 'tag',
|
type: 'tag',
|
||||||
tagName: bucketTagName,
|
tagName: bucketTagName,
|
||||||
share_mode: 'SEND_TASK'
|
share_mode: 'SEND_TASK'
|
||||||
});
|
}, { requestKey: null });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Failed to ensure system rule for bucket ${bucketTagName}`, e);
|
console.error(`Failed to ensure system rule for bucket ${bucketTagName}`, e);
|
||||||
}
|
}
|
||||||
@@ -1710,7 +1710,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
color: "#64748b",
|
color: "#64748b",
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
isUser: true
|
isUser: true
|
||||||
});
|
}, { requestKey: null });
|
||||||
setStore("tagDefinitions", prev => [...prev, {
|
setStore("tagDefinitions", prev => [...prev, {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
name: record.name,
|
name: record.name,
|
||||||
@@ -1724,7 +1724,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
}
|
}
|
||||||
} else if (!tagExistsExact.isUser) {
|
} else if (!tagExistsExact.isUser) {
|
||||||
try {
|
try {
|
||||||
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isUser: true });
|
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isUser: true }, { requestKey: null });
|
||||||
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isUser: true });
|
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isUser: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Failed to flag tag ${userName} as user`, e);
|
console.error(`Failed to flag tag ${userName} as user`, e);
|
||||||
@@ -1749,7 +1749,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
if (selfRuleLegacy && !selfRuleExact) {
|
if (selfRuleLegacy && !selfRuleExact) {
|
||||||
// Rename legacy self-rule
|
// Rename legacy self-rule
|
||||||
try {
|
try {
|
||||||
await pb.collection(SHARE_RULES_COLLECTION).update(selfRuleLegacy.id, { tagName: userName });
|
await pb.collection(SHARE_RULES_COLLECTION).update(selfRuleLegacy.id, { tagName: userName }, { requestKey: null });
|
||||||
setStore("shareRules", r => r.id === selfRuleLegacy.id, { tagName: userName });
|
setStore("shareRules", r => r.id === selfRuleLegacy.id, { tagName: userName });
|
||||||
console.log(`Renamed legacy self-rule: ${originalName} -> ${userName}`);
|
console.log(`Renamed legacy self-rule: ${originalName} -> ${userName}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1763,7 +1763,7 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
type: 'tag',
|
type: 'tag',
|
||||||
tagName: userName,
|
tagName: userName,
|
||||||
share_mode: 'ADD_USER'
|
share_mode: 'ADD_USER'
|
||||||
});
|
}, { requestKey: null });
|
||||||
|
|
||||||
const newRule: ShareRule = {
|
const newRule: ShareRule = {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
@@ -1806,7 +1806,7 @@ export const renameTagDefinition = async (oldName: string, newName: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await pb.collection(TAGS_COLLECTION).update(def.id, { name: finalName });
|
await pb.collection(TAGS_COLLECTION).update(def.id, { name: finalName }, { requestKey: null });
|
||||||
setStore("tagDefinitions", (d) => d.id === def.id, { name: finalName });
|
setStore("tagDefinitions", (d) => d.id === def.id, { name: finalName });
|
||||||
|
|
||||||
const tasksWithTag = store.tasks.filter(t => t.tags?.includes(oldName));
|
const tasksWithTag = store.tasks.filter(t => t.tags?.includes(oldName));
|
||||||
@@ -1820,7 +1820,7 @@ export const renameTagDefinition = async (oldName: string, newName: string) => {
|
|||||||
const rulesWithTag = store.shareRules.filter(r => r.tagName === oldName);
|
const rulesWithTag = store.shareRules.filter(r => r.tagName === oldName);
|
||||||
for (const rule of rulesWithTag) {
|
for (const rule of rulesWithTag) {
|
||||||
try {
|
try {
|
||||||
await pb.collection(SHARE_RULES_COLLECTION).update(rule.id, { tagName: finalName });
|
await pb.collection(SHARE_RULES_COLLECTION).update(rule.id, { tagName: finalName }, { requestKey: null });
|
||||||
setStore("shareRules", (r) => r.id === rule.id, { tagName: finalName });
|
setStore("shareRules", (r) => r.id === rule.id, { tagName: finalName });
|
||||||
console.log(`Synced ShareRule ${rule.id}: ${oldName} -> ${finalName}`);
|
console.log(`Synced ShareRule ${rule.id}: ${oldName} -> ${finalName}`);
|
||||||
} catch (ruleErr) {
|
} catch (ruleErr) {
|
||||||
@@ -1989,7 +1989,7 @@ export const addTemplate = async (template: Omit<TaskTemplate, "id">) => {
|
|||||||
completed: false,
|
completed: false,
|
||||||
startDate: new Date().toISOString(),
|
startDate: new Date().toISOString(),
|
||||||
dueDate: new Date().toISOString()
|
dueDate: new Date().toISOString()
|
||||||
});
|
}, { requestKey: null });
|
||||||
|
|
||||||
const newTemplate = { ...template, id: record.id };
|
const newTemplate = { ...template, id: record.id };
|
||||||
// Check if already added by realtime subscription
|
// Check if already added by realtime subscription
|
||||||
@@ -2194,7 +2194,7 @@ export const addShareRule = async (type: 'tag' | 'all', targetUserId: string, ta
|
|||||||
type,
|
type,
|
||||||
tagName: type === 'tag' ? tagName : null,
|
tagName: type === 'tag' ? tagName : null,
|
||||||
share_mode: share_mode || 'ADD_USER'
|
share_mode: share_mode || 'ADD_USER'
|
||||||
});
|
}, { requestKey: null });
|
||||||
// Realtime subscription will handle adding to store
|
// Realtime subscription will handle adding to store
|
||||||
toast.success(`Share rule created`);
|
toast.success(`Share rule created`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -2207,7 +2207,7 @@ export const updateShareRule = async (ruleId: string, updates: Partial<ShareRule
|
|||||||
if (!pb.authStore.isValid) return;
|
if (!pb.authStore.isValid) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await pb.collection(SHARE_RULES_COLLECTION).update(ruleId, updates);
|
await pb.collection(SHARE_RULES_COLLECTION).update(ruleId, updates, { requestKey: null });
|
||||||
setStore("shareRules", (rules) =>
|
setStore("shareRules", (rules) =>
|
||||||
rules.map(r => r.id === ruleId ? { ...r, ...updates } : r)
|
rules.map(r => r.id === ruleId ? { ...r, ...updates } : r)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user