You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/03 21:02:32 UTC

[GitHub] [airflow] jedcunningham commented on a diff in pull request #24152: Fix useTasks crash on error

jedcunningham commented on code in PR #24152:
URL: https://github.com/apache/airflow/pull/24152#discussion_r889347084


##########
airflow/www/jest-setup.js:
##########
@@ -20,6 +20,21 @@
  */
 
 import '@testing-library/jest-dom';
+import axios from 'axios';
+import { setLogger } from 'react-query';
+
+axios.defaults.adapter = require('axios/lib/adapters/http');
+
+axios.interceptors.response.use(
+  (res) => res.data || res,
+);
+
+setLogger({
+  log: console.log,
+  warn: console.warn,
+  // ✅ no more errors on the console

Review Comment:
   Maybe a silly question, if they don't end up on the console, where do they end up?



##########
airflow/www/static/js/grid/index.jsx:
##########
@@ -42,14 +42,19 @@ const myCache = createCache({
 const mainElement = document.getElementById('react-container');
 shadowRoot.appendChild(mainElement);
 
+const now = new Date();
+const minAgo = now.setMinutes(now.getMinutes() - 6);
+
 const queryClient = new QueryClient({
   defaultOptions: {
     queries: {
+      notifyOnChangeProps: 'tracked',
       refetchOnWindowFocus: false,
       retry: 1,
       retryDelay: 500,
-      staleTime: 5 * 60 * 1000, // 5 minutes
       refetchOnMount: true, // Refetches stale queries, not "always"
+      staleTime: 5 * 60 * 1000, // 5 minutes
+      initialDataUpdatedAt: minAgo, // make sure initial data is already expired

Review Comment:
   I think this also works, and makes it a little simpler:
   ```suggestion
         initialDataUpdatedAt: new Date().setMinutes(-6), // make sure initial data is already expired
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org