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

[DONT MERGE] chore(EMI-2213): client side signals tracking #15055

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rquartararo
Copy link
Member

@rquartararo rquartararo commented Jan 7, 2025

The type of this PR is: Chore

This PR solves EMI-2213

Description

This updates the signals tracking to work with client-side loading.

My solution was to use the grid context to get accurate data for client-side signal tracking.

NOTE: We will create a review app to QA tomorrow and then merge at same time as switching the FF.

@rquartararo rquartararo self-assigned this Jan 7, 2025
@rquartararo rquartararo marked this pull request as draft January 7, 2025 13:05
@rquartararo rquartararo requested a review from starsirius January 7, 2025 13:27
Copy link

relativeci bot commented Jan 7, 2025

#1447 Bundle Size — 8.99MiB (+0.05%).

9b8161b(current) vs 8385611 main#1444(baseline)

Warning

Bundle contains 14 duplicate packages – View duplicate packages

Bundle metrics  Change 4 changes Regression 2 regressions
                 Current
#1447
     Baseline
#1444
Regression  Initial JS 3.66MiB(+0.02%) 3.66MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 73.01% 43.88%
No change  Chunks 103 103
No change  Assets 106 106
Change  Modules 5843(+0.02%) 5842
Regression  Duplicate Modules 530(+0.19%) 529
No change  Duplicate Code 4.02% 4.02%
No change  Packages 266 266
No change  Duplicate Packages 13 13
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#1447
     Baseline
#1444
Regression  JS 8.85MiB (+0.05%) 8.84MiB
No change  Other 143.36KiB 143.36KiB

Bundle analysis reportBranch rquartararo/client-side-signals-...Project dashboard


Generated by RelativeCIDocumentationReport issue

@rquartararo rquartararo marked this pull request as ready for review January 7, 2025 13:31
@rquartararo rquartararo requested a review from damassi January 7, 2025 13:33
@rquartararo rquartararo changed the title chore(EMI-2213): client side signals tracking [DONT MERGE] chore(EMI-2213): client side signals tracking Jan 7, 2025
@artsy-peril
Copy link
Contributor

artsy-peril bot commented Jan 7, 2025

Fails
🚫

Hi there! 👋

We use conventional commit formatting which has not been detected in your PRs title.

Refer to README#327 and Conventional Commits for PR/commit formatting guidelines.

Generated by 🚫 dangerJS against 9b8161b


signals?: { [id: string]: string[] }

updateSignals?: (id: string, newSignals: string[]) => void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To summarize the approach, the context maintains a signals data structure that keeps track of all the artworks and their individual collector signals (which can be updated client side in the PrimaryLabelLine component). In the grid/rail item onClick callback, we'll refer to this signals map to fire tracking calls with the correct signals (which may or may not be overwritten on the client side).

if (label) {
signals.push(label)
}
updateSignals(artwork.internalID, signals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place we update signals (for tracking purposes). I think it makes sense because this component represents the display of the collector signals to users. We might have to keep in mind if in the future the visual or the exact component implementation changes, we'll update the tracking accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#non-blocking. I wonder if we need to use an array to keep track of multiple collector signals for each artwork. Perhaps it can just be a 1:1 mapping, given that we only show 1 primary label.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes right now the signal prioritization logic is in getSignalLabel but we could do it here and we would no longer need an array of signals. I was thinking we might have a separate use case for keeping track of all signals on an artwork in the future? Okay with a 1:1 mapping as well though.

endAt
}
increasedInterest
curatorsPick
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now on the MP schema side, we separate out the fields requiring auth (e.g. partnerOffer) from fields without requiring auth (e.g. primaryLabel), we'll need to request them both.

/>
</>
)}
<ArtworkGridContextProvider>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same context and the signals data structure are shared among multiple grids/rails, and I think that means when rendering each grid/rail, the same signals will get updated. I guess it's possible that the desired signals of an artwork could be updated back and forth with server-side and client-side signals, but it would eventually settled with the desired signals, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants