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

feat: load limited-time offer signals on the client side #14897

Merged
merged 16 commits into from
Jan 2, 2025

Conversation

starsirius
Copy link
Member

@starsirius starsirius commented Nov 22, 2024

The type of this PR is: Feat

This PR solves EMI-2161

Description

In the previous attempt, we tried a few design options to display the limited-time offer signals on the client-side. We then realized the signal has to be considered together with other badge signals (i.e. "increased interest" and "curators' pick") because we only want to display at most one. So we decided to switch back to the original signals design and let client-side loaded signals, if any, dynamically replace server-side rendered content. We now think it's acceptable to have content shift for this particular data which is relatively lower volume.

  • This is an example that the client-side loaded limited-time offer signal replaces an increased interest badge in-place. We can see the offered price also replaces the listed price shortly after page loads, as well as the timer and save state pops in.

    Recording

    client-side-collector-signals-with-primary-label

  • This is an example when without other badges, the limited-time offer badge is inserted which causes some content shift.

    Recording

    client-side-collector-signals-no-primary-label

cc @artsy/emerald-devs

@starsirius starsirius self-assigned this Nov 22, 2024
Copy link

relativeci bot commented Nov 22, 2024

#1428 Bundle Size — 8.98MiB (+0.33%).

46fc278(current) vs 81674c0 main#1427(baseline)

Warning

Bundle contains 14 duplicate packages – View duplicate packages

Bundle metrics  Change 3 changes Regression 1 regression
                 Current
#1428
     Baseline
#1427
Regression  Initial JS 3.66MiB(+0.1%) 3.65MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 75.85% 39.33%
No change  Chunks 103 103
No change  Assets 106 106
Change  Modules 5842(+0.1%) 5836
No change  Duplicate Modules 529 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
#1428
     Baseline
#1427
Regression  JS 8.84MiB (+0.33%) 8.81MiB
No change  Other 143.36KiB 143.36KiB

Bundle analysis reportBranch review-app-client-side-collector...Project dashboard


Generated by RelativeCIDocumentationReport issue

)
}

const SaleMessageFragmentContainer = createFragmentContainer(SaleMessage, {
Copy link
Member

Choose a reason for hiding this comment

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

#nonblocking and harmless, but would def encourage all new relay code to be written using hooks:

const data = useFragment(...)

Its a bit nicer from an import perspective too; can do import { SaleMessage } from vs having to mention fragment containers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good to know! I was confused about the best practices doc that recommends relay containers.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that's quite updated. I'll update that.

signal_label: artwork.collectorSignals
? getSignalLabel(artwork.collectorSignals)
: "",
signal_label: getSignalLabel(signals?.[artwork.internalID] ?? []),
Copy link
Member Author

Choose a reason for hiding this comment

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

Would this populate the data when the PrimaryLabelLine component is not rendered with this ArtworkSidebarCommercialButtons component? I think we might still need a way to use the backend sourced signals. But I could be missing something here.

Copy link
Member

Choose a reason for hiding this comment

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

Let me check this!

@rquartararo rquartararo force-pushed the review-app-client-side-collector-signals branch from 601b617 to cd42dab Compare December 17, 2024 16:37
This depends on MP change that removes partner offers from primary
labels. Primary label should only consist of unauthenticated data.
Now we have to consider partner offer (that's loaded on the client side)
when displaying "increased interest" and "curtors' pick" badges (that
can be loaded on the server and cached), it may visually look better
moving the limited-time offer back to the first line, with the badges.
While there will be some content shift, we can preserve the original
collector signals design (vs. partially porting over the app design).
@starsirius starsirius force-pushed the review-app-client-side-collector-signals branch from 9195398 to 46fc278 Compare January 2, 2025 19:31
@starsirius starsirius changed the title [DONT MERGE] feat: load limited-time offer signals on the client side feat: load limited-time offer signals on the client side Jan 2, 2025
@starsirius
Copy link
Member Author

OK @rquartararo as we agreed on, the last commit put the clientside behavior behind a feature flag. I tested it locally (see below) and it seems to behave correctly. If this looks good to you, I'm going to merge this PR and we can create a separate PR for your tracking changes. And then we'll QA as a group next week! 🎉

Note that I didn't guard everything behind the feature flag since I think some visual improvement (such as fixing height) is worth adding in.

  • When the feature flag is disabled:

    Screenshot (staging on the left, this PR on the right)

    Screenshot 2025-01-02 at 3 31 29 PM

  • When the feature flag is enabled:

    Recording (staging on the left, this PR on the right)

    clientside-signals

@starsirius starsirius marked this pull request as ready for review January 2, 2025 20:41
Copy link
Member

@damassi damassi left a comment

Choose a reason for hiding this comment

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

Lots of detail in this PR! Thanks so much for taking it on.

My only Q is: do we need the feature flag, or can we just push it to a quick review-app and test things that way?

@starsirius
Copy link
Member Author

My only Q is: do we need the feature flag, or can we just push it to a quick review-app and test things that way?

Yeah, my original plan was exactly that, and then the change grows to require more tracking changes (which will be included in a separate PR) and needs to be coordinated with the upstream changes. Plus the wide surface areas this change will touch, so I want to roll it out in a more manageable/less risky way.

Copy link
Member

@rquartararo rquartararo left a comment

Choose a reason for hiding this comment

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

🎉

@starsirius starsirius merged commit 4115d48 into main Jan 2, 2025
13 checks passed
@starsirius starsirius deleted the review-app-client-side-collector-signals branch January 2, 2025 21:09
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.

3 participants