Skip to content

fix: use plain fetch instead of this.fetch in analytics methods#1725

Merged
nevo-david merged 1 commit into
mainfrom
fix/analytics-plain-fetch
Jul 15, 2026
Merged

fix: use plain fetch instead of this.fetch in analytics methods#1725
nevo-david merged 1 commit into
mainfrom
fix/analytics-plain-fetch

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

Problem

this.fetch (from SocialAbstract) is the posting wrapper: it routes response bodies through handleErrors(), sleeps 5s and retries on 429/500, and throws Temporal ApplicationFailures (BadBody/RefreshToken). None of that belongs in analytics calls served from the backend API — and it forces analytics concerns into handleErrors, as seen in #1665 (review: "this.fetch should not be connected with pinterest analytics").

Changes

Swapped this.fetch → plain fetch (the pattern every existing analytics() implementation already uses) in every analytics method that used it:

  • PinterestpostAnalytics
  • FacebookpostAnalytics
  • InstagrampostAnalytics
  • LinkedIn PagepostAnalytics (2 calls)
  • ThreadspostAnalytics
  • TikTokanalytics (3 calls) and postAnalytics (2 calls)

On failure these methods now fall into their existing catch/fallback paths and return empty data, same as the plain-fetch analytics methods behave today. Non-analytics uses of this.fetch (posting, TikTok missing(), LinkedIn repost plug) are untouched.

🤖 Generated with Claude Code

this.fetch is the posting wrapper: it routes errors through handleErrors,
sleeps and retries on 429/500, and throws Temporal ApplicationFailures
(BadBody/RefreshToken) — none of which belong in analytics calls served
from the API. Analytics methods that fail now return empty data like the
existing plain-fetch analytics implementations do.

Affected: Pinterest, Facebook, Instagram, LinkedIn Page, Threads
(postAnalytics) and TikTok (analytics + postAnalytics).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Jul 14, 2026
@postiz-contribution

Copy link
Copy Markdown

Contribution-checker quality warning
Heuristic score: 8/100 (low). This is a non-blocking warning surfaced by the project's quality settings.

Heuristics that flagged:

  • Excessive inline code references: 19 inline refs (>3)
  • PR doesn't use the repo's PR template: 5 required checkbox items missing (max 1, match ≥80%)
  • Body adds too many extra headers beyond the template: 2 extra headers (>1)
  • AI watermark phrase: Matched: "Generated with Claude Code"
  • Commit message too long: Longest: 583 chars

If this is a genuine contribution, please add detail to your PR description and tighten the diff scope before reviewers look at it.

@postiz-agent

postiz-agent Bot commented Jul 14, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@nevo-david nevo-david merged commit 697acf9 into main Jul 15, 2026
11 checks passed
@nevo-david nevo-david deleted the fix/analytics-plain-fetch branch July 15, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants