计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
framer-performance-tuning【效率与协作】Optimize Framer API performance with caching, batching, and connection pooling. Use when experiencing slow API responses, implementing caching strategies, or optimizing request throughput for Framer integrations. Trigger with phrases like "framer performance", "optimize framer", "framer latency", "framer caching", "framer slow", "framer batch".
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: framer-performance-tuning description: 'Optimize Framer API performance with caching, batching, and connection pooling.
Use when experiencing slow API responses, implementing caching strategies,
or optimizing request throughput for Framer integrations.
Trigger with phrases like "framer performance", "optimize framer",
"framer latency", "framer caching", "framer slow", "framer batch".
' allowed-tools: Read, Write, Edit version: 1.5.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:
A staging site, aggregate performance baseline, approved content/assets, a change owner, and rollback path.
Revert changes that harm accessibility, publishing, privacy, or agreed performance thresholds; retain only redacted telemetry for review.
Optimize a fictional staging page, compare aggregate performance metrics, and roll back if a synthetic form or route check regresses.
Optimize Framer plugin, component, and Server API performance. Key areas: CMS sync speed, component render performance, and plugin responsiveness.
// Process large collections in batches to avoid timeouts
async function batchSync(collection: any, items: any[], batchSize = 50) {
const total = items.length;
for (let i = 0; i < total; i += batchSize) {
await collection.setItems(items.slice(i, i + batchSize));
const progress = Math.min(i + batchSize, total);
framer.notify(`Synced ${progress}/${total}`);
}
}
import { memo, useMemo } from 'react';
// Memoize expensive components
export default memo(function DataGrid({ data, columns }) {
const processedData = useMemo(() =>
data.map(row => columns.reduce((acc, col) => ({ ...acc, [col.key]: row[col.key] }), {})),
[data, columns]
);
return (
<div style={{ display: 'grid', gridTemplateColumns: `repeat(${columns.length}, 1fr)` }}>
{processedData.map((row, i) => columns.map(col => (
<div key={`${i}-${col.key}`} style={{ padding: 8 }}>{row[col.key]}</div>
)))}
</div>
);
});
// Reuse Server API connection instead of reconnecting each time
let clientInstance: any = null;
async function getClient() {
if (!clientInstance) {
const { framer } = await import('framer-api');
clientInstance = await framer.connect({
apiKey: process.env.FRAMER_API_KEY!,
siteId: process.env.FRAMER_SITE_ID!,
});
}
return clientInstance;
}
// Pre-optimize image URLs before syncing to CMS
function optimizeImageUrl(url: string, width = 800): string {
// Use image CDN if available
if (url.includes('cloudinary.com')) {
return url.replace('/upload/', `/upload/w_${width},q_auto,f_auto/`);
}
if (url.includes('imgix.net')) {
return `${url}?w=${width}&auto=format,compress`;
}
return url;
}
For cost optimization, see framer-cost-tuning.