Add button to clear loaded items #98
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #77
Add a button to the ListPane component that clears loaded items. This will allow the user to clear and reload resources, resource templates, prompts or tools when they expect the available items to have changed.
Motivation and Context
As noted in #77, once items (Resources, Resource Templates, Tools or Prompts) have been loaded they can't be loaded again. When adding resources or making changes to the other functionalities of the server while using the inspector, the available items might change. To load the fresh data currently requires reloading the inspector and setting up the connection again. By adding a button to clear items and any cursor that was set we can reload items without having to reconnect.
How Has This Been Tested?
Tested manually by connecting to some of the example servers with the inspector.
Breaking Changes
No breaking changes.
Types of changes
Checklist
Additional context
I initially tried a different approach where the original load button would always fetch and replace existing items. Then instead of adding a button to clear items, we could add a "Load more" button at the bottom of the loaded results. However, the way cursors are stored would have to be refactored and I ran into #97.
I think that approach would lead to a better user experience, but would require more changes and some more thinking. So for now I created this PR with the smallest change required to allow users to reload items.