Skip to content

fix(popper): resolve SSR issue in FPopper/FTooltip components#965

Open
wanchun wants to merge 3 commits into
mainfrom
fix/popper-tooltip-ssr
Open

fix(popper): resolve SSR issue in FPopper/FTooltip components#965
wanchun wants to merge 3 commits into
mainfrom
fix/popper-tooltip-ssr

Conversation

@wanchun

@wanchun wanchun commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

FPopper/FTooltip 组件在 SSR 环境下报 ReferenceError: document is not defined

Root Cause

  1. components/_util/utils.tsdefaultContainer 直接访问 document.body
  2. components/popper/usePopper.tspopupManager.nextZIndex()getBoundingClientRect() 在 SSR 时调用

Fix

  1. components/_util/isServer.ts - 新增 isServer 工具变量
  2. components/_util/utils.ts - defaultContainer 添加 typeof document !== 'undefined' 判断
  3. components/popper/usePopper.ts:
    • popupManager.nextZIndex() 在 SSR 时使用默认值 2000
    • computePopper 在 SSR 时直接返回不执行
    • 添加 rawTriggerEl 空值检查

@wanchun wanchun force-pushed the fix/popper-tooltip-ssr branch from c4519a9 to fc61baf Compare May 14, 2026 07:14
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.

1 participant