Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid access document or window in server side #4101

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

kingyue737
Copy link
Contributor

Description

X6在多处module scope中直接访问了documentwindow等仅在client端可用的变量,导致一旦import '@antv/X6'服务端渲染就会出错(根据README,X6本应该支持服务端渲染)

X6/README.md

Line 32 in f2cae96

- 支持服务端渲染。

本PR将document等移至函数中,或加上条件保护,使代码在server端也能正常运行。

Motivation and Context

fix #4095

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Enhancement (changes that improvement of current feature or performance)
  • Refactoring (changes that neither fixes a bug nor adds a feature)
  • Test Case (changes that add missing tests or correct existing tests)
  • Code style optimization (changes that do not affect the meaning of the code)
  • Docs (changes that only update documentation)
  • Chore (changes that don't modify src or test files)

Self Check before Merge

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@x6-bot x6-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. PR: unreviewed PR does not have any reviews. labels Dec 14, 2023
@x6-bot x6-bot bot added PR: reviewed-approved PR has reviewed and got Approve from everyone. and removed PR: unreviewed PR does not have any reviews. labels Jan 9, 2024
@NewByVector NewByVector merged commit 31be706 into antvis:master Jan 9, 2024
14 checks passed
@x6-bot x6-bot bot added PR: merged PR has merged. and removed PR: reviewed-approved PR has reviewed and got Approve from everyone. labels Jan 9, 2024
@kingyue737 kingyue737 deleted the fix-ssr branch January 9, 2024 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:x6 PR: merged PR has merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X6并不支持服务端渲染
2 participants