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

[SSR] Implement EuiSsrProvider to provide a context for stable unique ID generation #7094

Closed
Tracked by #5419
tkajtoch opened this issue Aug 17, 2023 · 2 comments
Closed
Tracked by #5419

Comments

@tkajtoch
Copy link
Member

Summary

To provide stable unique identifier generation between the client and server side, we need to introduce a new context to be used whenever EUI is rendered on the server and hydrated in the browser.

The official React.useId hook already provides stable ID generation in function components but is only available in React 18. We must provide a universal solution since we officially support React 16 and up and still have many class components utilizing htmlIdGenerator that can't use this new fancy hook directly.

Acceptance Criteria

  • <EuiSsrProvider> should be implemented to provide a new React context
  • The context should store the following properties
    • prefix: string - a global prefix to use in all generations in the scope of the provider instance (default to a random 6-digit hash);
    • current: number - a value incremented by one on every id generation call
  • <EuiSsrProvider> context should be used to generate stable unique IDs in useGeneratedHtmlId()
Copy link

👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.

Copy link

❌ Per our previous message, this issue is auto-closing after having been open and inactive for a year. If you strongly feel this is still a high-priority issue, or are interested in contributing, please leave a comment or open a new issue linking to this one for context.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant