Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Only change updatedAt for templates for PUT call from deploy modal.

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 29, 2025 8:08pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 29, 2025

Greptile Summary

Removed updatedAt timestamp updates from template view and star count operations, preserving the timestamp for actual content changes via the PUT endpoint. Previously, viewing a template, starring/unstarring, or using a template would incorrectly update the updatedAt timestamp even though no meaningful content changed. Now only the PUT endpoint (used by deploy modal for metadata/workflow updates) modifies updatedAt, providing accurate tracking of when template content was last modified.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are surgical and correct - removing unnecessary timestamp updates from counter-only operations while preserving the PUT endpoint's behavior for actual content updates. The logic is sound and aligns with semantic versioning principles where updatedAt should reflect content changes, not view/interaction metrics.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/api/templates/[id]/route.ts Removed updatedAt from GET view increment - correctly keeps timestamp unchanged for view tracking
apps/sim/app/api/templates/[id]/star/route.ts Removed updatedAt from POST/DELETE star operations - correctly prevents timestamp changes for social interactions
apps/sim/app/api/templates/[id]/use/route.ts Removed updatedAt from POST use operation - correctly keeps timestamp unchanged when incrementing view count

Sequence Diagram

sequenceDiagram
    participant Client
    participant GET as GET /templates/[id]
    participant PUT as PUT /templates/[id]
    participant POST_Star as POST /templates/[id]/star
    participant DELETE_Star as DELETE /templates/[id]/star
    participant POST_Use as POST /templates/[id]/use
    participant DB as Database

    Note over Client,DB: Before: All operations updated updatedAt timestamp

    Client->>GET: View template
    GET->>DB: UPDATE views + 1
    Note over DB: ❌ Previously: updatedAt = new Date()<br/>✅ Now: updatedAt unchanged
    DB-->>GET: Success
    GET-->>Client: Template data

    Client->>POST_Star: Star template
    POST_Star->>DB: UPDATE stars + 1
    Note over DB: ❌ Previously: updatedAt = new Date()<br/>✅ Now: updatedAt unchanged
    DB-->>POST_Star: Success
    POST_Star-->>Client: Starred

    Client->>DELETE_Star: Unstar template
    DELETE_Star->>DB: UPDATE stars - 1
    Note over DB: ❌ Previously: updatedAt = new Date()<br/>✅ Now: updatedAt unchanged
    DB-->>DELETE_Star: Success
    DELETE_Star-->>Client: Unstarred

    Client->>POST_Use: Use template
    POST_Use->>DB: UPDATE views + 1
    Note over DB: ❌ Previously: updatedAt = now<br/>✅ Now: updatedAt unchanged
    DB-->>POST_Use: Success
    POST_Use-->>Client: Workflow created

    Note over Client,DB: PUT endpoint still updates updatedAt for actual content changes

    Client->>PUT: Update template metadata/workflow
    PUT->>DB: UPDATE with updatedAt = new Date()
    Note over DB: ✅ updatedAt still updated for real changes
    DB-->>PUT: Success
    PUT-->>Client: Updated template
Loading

@icecrasher321 icecrasher321 merged commit 400178a into staging Dec 29, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants