feat: make local source IDs deterministic for stable deep links#2080
Draft
feat: make local source IDs deterministic for stable deep links#2080
Conversation
When IS_LOCAL_MODE sources are created (e.g. via 'Connect to Demo Server'), IDs are now derived from a stable hash of the item content instead of Math.random(). This ensures every user who connects to the same demo server gets the same source IDs, making deep links with ?source=<id> work across different users/sessions. Uses key-order-independent JSON serialization (stableStringify) so that properties supplied in different insertion order still produce the same ID. Closes HDX-3974 Co-authored-by: Drew Davis <pulpdrew@gmail.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
E2E Test Results✅ All tests passed • 130 passed • 3 skipped • 1069s
Tests ran across 4 shards in parallel. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
IS_LOCAL_MODEsources are created (e.g. via "Connect to Demo Server" in the onboarding modal), IDs are now derived from a stable hash of the item content instead ofMath.random(). This ensures every user who connects to the same demo server gets the same source IDs, making deep links with?source=<id>work across different users and sessions.Previously,
localStore.create()generated IDs viahashCode(Math.random().toString()), producing different IDs on every invocation. Now it useshashCode(stableStringify(item))wherestableStringifyis a key-order-independent JSON serializer, so the same source configuration always produces the same ID regardless of property insertion order.How to test locally or on Vercel
?source=...) are identical in both browsersReferences
Linear Issue: HDX-3974