Commit Graph
8 Commits
Author SHA1 Message Date
Alaister Young ad01744064 fix(studio): avoid SSR hydration mismatch in Support form prefill
The previous commit's synchronous-seed approach made the form read
window.location.search at hook init, which means SSG/SSR renders bare
defaults (no window) and the client's first render uses URL-derived
defaults — a hydration mismatch.

Revert to the original useEffect setValue pattern (no window access
at render time → SSR/SSG matches client first render), and instead
neutralise the Radix Select bug at the leaf:

- CategoryAndSeverityInfo: when the category Select's controlled value
  transitions from undefined to a defined value whose SelectItem isn't
  mounted yet (dropdown closed, items only register on portal mount),
  Radix's hidden BubbleSelect emits onValueChange('') and clears the
  form field. No SelectItem can have value="" (Radix throws on it),
  so any onValueChange('') is guaranteed to be the spurious bubble —
  drop it before calling field.onChange. (radix-ui/primitives#3381)
2026-05-11 17:36:45 +08:00
Alaister Young bfaf6bd593 fix(studio): get unit tests passing on React 19 / TanStack branch
The React 19 bump exposed four React-version-sensitive patterns that
were silently fine on 18:

- useStateTransition: React 18+ auto-batches dispatch SUBMIT and the
  mutation's dispatch ERROR across the intervening awaits, collapsing
  editing → submitting → error into a single render where the
  submitting tick is never observed. Relax the check to fire on entry
  into newTest from any state other than newTest, which is a strict
  superset of the old prevTest → newTest condition for our reducers
  (success/error are only reachable from submitting anyway).

- useSupportForm: seed defaultValues from window.location.search
  synchronously via useMemo instead of patching them in a useEffect
  setValue. The old flow flipped the category Radix Select from
  uncontrolled to controlled mid-mount, which on React 19 spuriously
  emits onValueChange('') (radix-ui/primitives#3381) and clears the
  field. The new flow keeps the Select controlled from first paint.

- EditSecretModal test: switch the post-dialog getByLabelText to
  findByLabelText. The vault list query opens the dialog but the
  decrypted-value query resolves on a separate render tick under
  React 19's scheduling, so the form fields appear one tick after the
  skeleton.

- LogsPreviewer test: use addEventListener instead of assigning
  loadOlder.onclick = vi.fn(). React 19 reassigns .onclick on managed
  elements as part of its event wiring, clobbering the direct-property
  spy before the assertion runs.

No changes to vitest config or shared test setup — both Next.js and
TanStack Start setups still share the same Vitest plumbing.
2026-05-11 17:21:52 +08:00
Saxon FletcherandGildas Garcia 4452e0ac2e Support form sidebar (#45203)
Refactors our help sidebar within Studio to include the actual support
form itself when contact is selected. This PR also cleans up the initial
state of the sidebar and the options within.

## To test:
- Open an org and click the help icon top right
- Click contact support
- Submit a support ticket
- Click done to return to support sidebar state

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Support form V3 and support sidebar with status button; direct-email
helper and URL prefill
* Success screen supports onFinish callback and customizable finish
label
* AI Assistant and Help options accept optional click callbacks;
resource items gain keyboard/accessibility support

* **Refactor**
  * Help panel split into home/support views with back navigation
* Support components accept flexible align/className props and
layout/styling tweaks
  * Initial URL params loader added for support form

* **Tests**
* New/updated tests for support flows, success screen, and help options
interactions
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
2026-05-08 13:51:49 +10:00
4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Ivan Vasilov 0d5be306ef chore: Bump React Query to v5 (#40174)
* Bump the deps, refactor deprecated code.

* Migrate keepPreviousData usage.

* Migrate all uses of InfiniteQuery.

* Fix refetchInterval in queries.

* Migrate all use of isLoading to isPending in mutations.

* Fix accessing location in claim-project.

* Fix a bug in duplicate query keys.

* Migrate all queries to use isPending.

* Revert "Fix accessing location in claim-project."

This reverts commit 2a07df64b5.

* Revert the rss.xml file to master.
2025-12-10 10:10:29 +01:00
CharisandJoshen Lim d8f7cc0d57 feat(support form): attach dashboard logs (#39539)
* o11y: mirror and sanitize breadcrumbs

Mirror Sentry breadcrumbs as the basis for our own support logging. Also
adds more sanitization to breadcrumbs.

* feat(support form): toggle for attaching dashboard  logs

Add a toggle to the support form when the category is "Dashboard bug",
to attach recent dashboard logs. Users can preview the attached logs and
opt out.

* feat(support links): dedicated support link component

Add a new component for support links, which:
- Uses the serializer for support link params to ensure
serialization/deserialization pairs correctly
- Snapshots breadcrumbs so the attached log on the support form will be
cut off at the support link click (otherwise we will get support form
actions cluttering up the log)

* tests(support form): extend timeout on flaky test

* Minor clean up

* fix(support form): allow url to specifically indicate no specified project

* minor nits

* Fix tests

* Fix tests

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-22 08:57:49 -04:00
Alaister YoungandJoshen Lim 947d3b2a73 fix: plan upgrade url for org usage pages (#39608)
* fix: plan upgrade url for org usage pages

* nit fix

* fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-17 14:41:54 +08:00
CharisandJoshen Lim f5ff10e195 refactor,tests(support form) (#39410)
* refactor: refactor support form

Refactor support form to make it easier to maintain:
- Split up large components into smaller components and hooks
- Lift state up so we don't have to do complex child/parent
state-syncing via useEffect
- Use nuqs parsing for consistent serialization/deserialization of
support form prefilled fields

* test: support form

Add comprehensive tests for support form

* fix(support form): project and org empty state

* Nit clean up

* More clean up

* cleannnn

* fix(support form): allow case-insensitive category in url

* clean(support form tests): remove unused param

* fix(support form): incorrect logic for sending affected services in payload

* clean(support form): use NO_ORG_MARKER and NO_PROJECT_MARKER instead of strings

* fix(support form): don't show upgrade cta if already on enterprise

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-14 11:04:33 +08:00