Environment:
Kibana: 7.5 BC5
Elasticsearch: 7.5 BC5
Browsers: All
Steps to Reproduce:
Navigate to a watch that does not exist.聽
Expected:
Verify a message appears indicating the watch could not be found.
Actual:
The app never responds with anything about the watch status. It just shows a spinner forever.
Pinging @elastic/es-ui (Team:Elasticsearch UI)

Great catch @cuff-links! The problem is in api.ts:
export const loadWatchDetail = (id: string) => {
return useRequest({
path: `${basePath}/watch/${id}`,
method: 'get',
deserializer: ({ watch = {} }: { watch: any }) => Watch.fromUpstreamJson(watch),
});
};
Either the deserializer function or Watch.fromUpstreamJson needs to be updated to handle watch when it's undefined.
Thanks for this. I will pick this up once I am done with a current issue.
This bug also applies to useLoadWatches() in api.ts and possibly other places.
I think this a regression of https://github.com/elastic/kibana/pull/40777.
The use_request.ts file that was previously used in watcher had the following check that prevented the data from being processed if it was undefined.
setData(processData && responseData ? processData(responseData) : responseData);
(https://github.com/elastic/kibana/pull/40777/files#diff-7f7e3125aba9242c0c94d499b2212e4dL93)
Great catch, @alisonelizabeth. Do you think we should incorporate that check into the shared useRequest function, or expect the consumer to handle it? I wouldn't expect a utility for sending requests to have opinions over the response, so the latter feels more intuitive to me.
@cjcenizal I agree, I think the latter makes sense. I just wanted to point out how it was previously handled, and that likely most of the functions consuming useRequest in watcher will need to be updated (or, as you mentioned, the fromUpstreamJson() function).
@alisonelizabeth This still needed?
@cuff-links Yes, I believe it is still a valid issue.