Fix prettier complaints
This commit is contained in:
@@ -128,7 +128,9 @@ const App = () => {
|
||||
const [selectedResource, setSelectedResource] = useState<Resource | null>(
|
||||
null,
|
||||
);
|
||||
const [resourceSubscriptions, setResourceSubscriptions] = useState<Set<string>>(new Set<string>());
|
||||
const [resourceSubscriptions, setResourceSubscriptions] = useState<
|
||||
Set<string>
|
||||
>(new Set<string>());
|
||||
|
||||
const [selectedPrompt, setSelectedPrompt] = useState<Prompt | null>(null);
|
||||
const [selectedTool, setSelectedTool] = useState<Tool | null>(null);
|
||||
@@ -311,7 +313,6 @@ const App = () => {
|
||||
};
|
||||
|
||||
const subscribeToResource = async (uri: string) => {
|
||||
|
||||
if (!resourceSubscriptions.has(uri)) {
|
||||
await makeRequest(
|
||||
{
|
||||
@@ -325,11 +326,9 @@ const App = () => {
|
||||
clone.add(uri);
|
||||
setResourceSubscriptions(clone);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const unsubscribeFromResource = async (uri: string) => {
|
||||
|
||||
if (resourceSubscriptions.has(uri)) {
|
||||
await makeRequest(
|
||||
{
|
||||
@@ -345,7 +344,6 @@ const App = () => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const listPrompts = async () => {
|
||||
const response = await makeRequest(
|
||||
{
|
||||
@@ -523,7 +521,9 @@ const App = () => {
|
||||
clearError("resources");
|
||||
setSelectedResource(resource);
|
||||
}}
|
||||
resourceSubscriptionsSupported={serverCapabilities?.resources?.subscribe || false}
|
||||
resourceSubscriptionsSupported={
|
||||
serverCapabilities?.resources?.subscribe || false
|
||||
}
|
||||
resourceSubscriptions={resourceSubscriptions}
|
||||
subscribeToResource={(uri) => {
|
||||
clearError("resources");
|
||||
|
||||
@@ -173,23 +173,28 @@ const ResourcesTab = ({
|
||||
</h3>
|
||||
{selectedResource && (
|
||||
<div className="flex row-auto gap-1 justify-end w-2/5">
|
||||
{ resourceSubscriptionsSupported && !resourceSubscriptions.has(selectedResource.uri) && <Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => subscribeToResource(selectedResource.uri)}
|
||||
>
|
||||
Subscribe
|
||||
</Button>
|
||||
}
|
||||
{ resourceSubscriptionsSupported && resourceSubscriptions.has(selectedResource.uri) &&
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => unsubscribeFromResource(selectedResource.uri)}
|
||||
>
|
||||
Unsubscribe
|
||||
</Button>
|
||||
}
|
||||
{resourceSubscriptionsSupported &&
|
||||
!resourceSubscriptions.has(selectedResource.uri) && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => subscribeToResource(selectedResource.uri)}
|
||||
>
|
||||
Subscribe
|
||||
</Button>
|
||||
)}
|
||||
{resourceSubscriptionsSupported &&
|
||||
resourceSubscriptions.has(selectedResource.uri) && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
unsubscribeFromResource(selectedResource.uri)
|
||||
}
|
||||
>
|
||||
Unsubscribe
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
|
||||
@@ -12,9 +12,9 @@ export const StdErrNotificationSchema = BaseNotificationSchema.extend({
|
||||
}),
|
||||
});
|
||||
|
||||
export const NotificationSchema = ClientNotificationSchema
|
||||
.or(StdErrNotificationSchema)
|
||||
.or(ServerNotificationSchema);
|
||||
export const NotificationSchema = ClientNotificationSchema.or(
|
||||
StdErrNotificationSchema,
|
||||
).or(ServerNotificationSchema);
|
||||
|
||||
export type StdErrNotification = z.infer<typeof StdErrNotificationSchema>;
|
||||
export type Notification = z.infer<typeof NotificationSchema>;
|
||||
|
||||
Reference in New Issue
Block a user