snowplow / snowplow/snowplow-javascript-tracker

Deep clone attached global context entites

Open
#1,086 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
590
Forks
232
Avg merge
2h 22m
Merged PRs (30d)
3

Description

Since global contexts are "long living" (the tracker keeps a reference to them until they are removed), we should deep clone any objects attached using addGlobalContexts to prevent unexpected changes when the original objects change in user code.

In particular, we should consider deep cloning around these lines.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in libraries/tracker-core/src/contexts.ts around lines 183–184 and inspect how addGlobalContexts stores attached objects. Check nearby tests or tracker-core test coverage for global contexts; done means later changes to the original objects no longer alter the contexts retained by the tracker.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.