Commit Graph
8 Commits
Author SHA1 Message Date
Drew McLellan 773b4f767c fix(common): skip the reduced-motion query when matchMedia is missing (#53613)
## Problem

`Marketing site tests / build` fails on PRs that touch www, with
`window.matchMedia is not a function` in `lib/sentry-capture.test.tsx`.

`packages/common/helpers.ts` calls `window.matchMedia` when it is
imported. jsdom does not implement it. #53294 made
`common/consent-state` import `posthog-client`, which reaches
`helpers.ts` through `telemetry-utils`. The www `sentry-browser` test
project runs in jsdom without a `matchMedia` stub, so it now crashes on
import.

The break went unnoticed on `master` because the www workflow only runs
on pull requests, and its path filter listed just two files in
`packages/common`.

This is the same problem several other places already work around:
`consent-state.ts` duplicates `ensurePlatformSuffix` to avoid the
import, and the `packages/common` and `kb` tests stub
`window.matchMedia` before importing.

## Solution

- Guard the call in `helpers.ts` with `typeof window.matchMedia ===
'function'`, so `useReducedMotion` returns `false` where the API is
missing. Browsers are unaffected.
- Add `packages/common/helpers.test.ts`. It imports `helpers` and
`consent-state` in jsdom without `matchMedia`, and checks that the query
is still read where it exists. Both import tests fail on `master` with
this error.
- Run the Marketing site tests on changes to `packages/common/**/*.ts*`
and its `package.json`, since www imports it widely. This part is
independent of the fix and can be split out if you prefer.

The `helpers.ts` change is identical to the one in #53589, so the two
merge cleanly whichever lands first. This earlier attempt, #53596, was
closed.

Not changed: the per-test `matchMedia` stubs. They're harmless, and can
be removed as a follow-up.

## Review instructions

1. From `packages/common`, run `pnpm exec vitest run helpers.test.ts`
and check that all 3 tests pass.
2. Run `git checkout origin/master -- packages/common/helpers.ts` and
run it again. Two tests should fail with `window.matchMedia is not a
function`. Then run `git checkout HEAD -- packages/common/helpers.ts`.
3. Check that `Marketing site tests / build` passes on this PR and ran
because of the `packages/common` path.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill (not applicable)
2026-11-18 14:30:07 +00:00
Sean Oliver 04a58c8d8f fix(common): ignore trailing slashes in ensurePlatformSuffix (#53065)
## Problem

`ensurePlatformSuffix` appends `/platform` to the API URL as-is. With
`NEXT_PUBLIC_API_URL` set to `https://api.supabase.com/` (trailing
slash), the kb search events from #52981 post to
`https://api.supabase.com//platform/telemetry/event`, which returns 404.
Nothing logs it, because the kb send path swallows errors.

Related: DOCS-1580

## Solution

Strip all trailing slashes before checking for or adding `/platform`,
using a loop instead of a regex (CodeQL flagged `/\/+$/` as polynomial).
`https://api.supabase.com/`, `//`, `.../platform`, `.../platform/` and
`.../platform//` now all resolve to `https://api.supabase.com/platform`.

## Review instructions

1. In `packages/common`, run `pnpm vitest run telemetry-event.test.ts`.
The new trailing-slash case fails on master and passes here.
2026-11-09 12:28:07 -08:00
Charis 30b6af4ff3 fix (docs): non-platform integrations page (#35285)
There were two bugs when trying to run the integrations page locally
with NEXT_PUBLIC_IS_PLATFORM=false:

1. The IS_PLATFORM check imported from common was not evaluating
correctly to a boolean. This is because I slapped a 'use client' on the
entire common package last year -_-""" which caused all its imports to
be evaluated to functions when used in server components. I have now
moved the 'use client's down to the submodules that actually need it.

2. When the integrations submenu is empty, the navigation menu errors
out because it expects all navigation items to either have children or
have links. Have updated this to gracefully hide empty headers.
2025-04-25 15:22:06 -04:00
Francesco Sansalvadore d24df14aab Feat/toc component (#33964)
* test fuma toc

* make toc work

* ok toc

* ui-patterns toc

* fix types

* cleanup

* fix overflow issues

* cleanup

* fix loading w

* Update apps/docs/components/GuidesTableOfContents.tsx

* fix prettier

* format

* install deps

* target ES2018

* tweak regex

* update docs test snapshots

* fix useSubscribeTocRerender
2025-03-05 23:10:02 +01:00
Alaister Young 4577389177 chore: send feature flags for page events (#32590) 2025-01-13 13:08:50 +08:00
Francesco Sansalvadore e76aa11508 homepage cleanup (#29295)
* new homepage logos marquee

* add products claim

* logos spacing

* dashboard table editor demo

* dashboard table editor demo

* dashboard recordings

* rls policies

* update hp frameworks

* add dataAPIs to homepage bento

* tweet section update

* padding

* hp products update

* new customer stories hp section

* height

* finish homepage details

* update logos

* fix database visual

* improve functions visual ux

* animate data-apis visual

* realtime visual update

* reduce-motion and update chatbase logo

* lighter heading paragraph

* improve video tabs components

* add priority to offsetted images

* video plays inline

* fix mobile tweets spacing

* smoll

* load video slightly before the component enters the viewport

* fix product pointer-events

* theme based and light weight dashboard video

* testimonials margin

* remove yellow tint from light mode recordings

* fix vitest window-matchMedia error

* fix vitest window-matchMedia error

* fix url type

* remove tweet
2024-09-17 11:07:38 +02:00
Francesco Sansalvadore a9abe79d56 Feat/privacy settings (#17896)
* privacy settings modal in www and docs
2023-10-05 16:10:53 +02:00
Francesco Sansalvadore 95d641da14 Reduce cursor tracking on Firefox 2023-08-31 16:17:19 +02:00