Skip to content

Render past results of mutation#991

Merged
kmcginnes merged 2 commits intoaws:mainfrom
kmcginnes:keep-mutation-state
Jun 10, 2025
Merged

Render past results of mutation#991
kmcginnes merged 2 commits intoaws:mainfrom
kmcginnes:keep-mutation-state

Conversation

@kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented Jun 10, 2025

Description

Restores the query results if the user switches sidebar panels or closes the sidebar.

This uses useMutationState hook from TanStack Query to access all past iterations of the mutation that have been executed. The last one in the array is the latest one, so we show the results of that mutation.

The result container logic had to be reworked since the way status is represented in the mutation is a little bit different.

This also adds an empty state for before a query is run and when cancelled.

Validation

  • Tested with error results
  • Tested with switching sidebar panels
  • Tested with closing sidebar
  • Tested with opening connections and going back to graph
  • Tested cancel long query

New empty state panel

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0
    license.
  • I have run pnpm checks to ensure code compiles and meets standards.
  • I have run pnpm test to check if all tests are passing.
  • I have covered new added functionality with unit tests if necessary.
  • I have added an entry in the Changelog.md.

@kmcginnes kmcginnes marked this pull request as ready for review June 10, 2025 01:26
@codecov
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 47 lines in your changes missing coverage. Please review.

Project coverage is 33.48%. Comparing base (a899239) to head (863cfc8).
Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
...rc/modules/SearchSidebar/QuerySearchTabContent.tsx 0.00% 47 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #991      +/-   ##
==========================================
+ Coverage   30.72%   33.48%   +2.75%     
==========================================
  Files         525      526       +1     
  Lines       23627    21415    -2212     
  Branches     1408     1524     +116     
==========================================
- Hits         7259     7170      -89     
+ Misses      16241    14127    -2114     
+ Partials      127      118       -9     
Flag Coverage Δ
unittests 33.48% <0.00%> (+2.75%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kmcginnes kmcginnes merged commit 67876e3 into aws:main Jun 10, 2025
3 of 4 checks passed
@kmcginnes kmcginnes deleted the keep-mutation-state branch June 10, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist query results when switching tabs/panels

2 participants