diff --git a/plugins/notion/src/api.ts b/plugins/notion/src/api.ts index 08fe8c7eb..f542ab766 100644 --- a/plugins/notion/src/api.ts +++ b/plugins/notion/src/api.ts @@ -85,6 +85,12 @@ export const supportedCMSTypeByNotionPropertyType = { formula: ["string", "number", "boolean", "date", "dateTime", "link", "color"], } satisfies Partial> +/** + * These Notion property types are always re-synced even when the page's `last_edited_time` is unchanged. + * Formula results and relation values can change without the last edited time being updated in Notion. + */ +export const alwaysSyncedPropertyTypes = ["formula", "relation"] + // Naive implementation to be authenticated, a token could be expired. // For simplicity we just close the plugin and clear storage in that case. export function isAuthenticated() { diff --git a/plugins/notion/src/data.ts b/plugins/notion/src/data.ts index 995292e78..039470991 100644 --- a/plugins/notion/src/data.ts +++ b/plugins/notion/src/data.ts @@ -4,12 +4,13 @@ import { type FieldDataEntryInput, type FieldDataInput, framer, - ManagedCollection, + type ManagedCollection, type ManagedCollectionFieldInput, } from "framer-plugin" import pLimit from "p-limit" import * as v from "valibot" import { + alwaysSyncedPropertyTypes, assertFieldTypeMatchesPropertyType, type FieldInfo, getDatabase, @@ -230,8 +231,15 @@ export async function syncCollection( const field = fieldsById.get(property.id) if (!field) continue - // Skip field value if the item has not changed and the field type has not changed - if (isUnchanged && !updatedFieldIds.has(field.id)) continue + // Skip field value if the item has not changed and the field type has not changed. + // Always synced property types are never skipped. + if ( + isUnchanged && + !updatedFieldIds.has(field.id) && + !alwaysSyncedPropertyTypes.includes(property.type) + ) { + continue + } const fieldEntry = getFieldDataEntryForProperty(property, field) if (fieldEntry) {