-
Notifications
You must be signed in to change notification settings - Fork 30
Improve ipad targeting query param #15048
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
base: main
Are you sure you want to change the base?
Conversation
Alternative implementation that uses localStorage + query parameter instead of cookies. This avoids the need for cookie approval. Changes: - iPadDetection.ts: Use localStorage instead of cookies - sdcUrl.ts: New utility to append deviceClass query param to SDC URLs - useSDC.ts: Use appendDeviceClassParam for all SDC hooks - ReaderRevenueEpic.tsx: Use appendDeviceClassParam for direct getEpic call - ReaderRevenueBanner.tsx: Use appendDeviceClassParam for direct getBanner call - Updated tests for localStorage-based approach - Added tests for appendDeviceClassParam utility
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
| * Sets the device class in localStorage if the device is detected as iPad. | ||
| * This value will be read and appended as a query parameter to SDC requests. | ||
| */ | ||
| export const setDeviceClass = (): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, the code became simpler :)
…eat-improve-ipad-targeting-query-param
What does this change?
Replace the URL manipulation approach with custom fetch functions that properly build SDC URLs with deviceClass query parameters. This ensures the query param is correctly appended to the endpoint path rather than the base URL.
Alternative to:
#15035