Skip to content

refactor(web): sync app context effects with jotai#38570

Merged
hyoban merged 4 commits into
mainfrom
0708-app-context-effect
Jul 8, 2026
Merged

refactor(web): sync app context effects with jotai#38570
hyoban merged 4 commits into
mainfrom
0708-app-context-effect

Conversation

@hyoban

@hyoban hyoban commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Replaces the app context bootstrap useEffect hooks with a jotai-effect atom that syncs Zendesk fields and Amplitude identity from app-context atoms.
  • Mounts the bootstrap sync once from CommonLayoutHydrationBoundary, shared by the authenticated common layouts.
  • Adds jotai-effect as a frontend dependency and updates focused tests around app context bootstrap and common layout hydration.

Related issue: N/A

Screenshots

Before After
N/A N/A

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This does not apply to typos!)
  • I have added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I have updated the documentation accordingly.
  • I ran pnpm --dir web test app/(commonLayout)/__tests__/hydration-boundary.spec.tsx context/__tests__/app-bootstrap-effects.spec.tsx --run and pnpm --dir web type-check.

From Codex

@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 8, 2026
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.50746% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.39%. Comparing base (23b936a) to head (10b84c1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
web/context/amplitude-identity-sync.ts 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #38570      +/-   ##
==========================================
+ Coverage   85.34%   85.39%   +0.05%     
==========================================
  Files        5016     5174     +158     
  Lines      266941   271378    +4437     
  Branches    50816    51906    +1090     
==========================================
+ Hits       227814   231742    +3928     
- Misses      34660    35169     +509     
  Partials     4467     4467              
Flag Coverage Δ
cli 88.48% <ø> (?)
dify-ui 94.61% <ø> (ø)
web 84.84% <98.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hyoban hyoban marked this pull request as ready for review July 8, 2026 15:54
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 8, 2026
@hyoban hyoban enabled auto-merge July 8, 2026 15:54
@dosubot dosubot Bot added the refactor label Jul 8, 2026
@hyoban hyoban added this pull request to the merge queue Jul 8, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 8, 2026
Merged via the queue into main with commit caf1a22 Jul 8, 2026
42 checks passed
@hyoban hyoban deleted the 0708-app-context-effect branch July 8, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants