Closed keithchong closed 3 years ago
@keithchong Mind taking a look? https://github.com/argoproj/argo-ui/pull/76/files
I think I covered all use cases for input/load combinations there including:
Hi @dcherman , I applied your changes (argocd built fine) and tested it out but I'm getting an invalid hook call. The argocd application page does not render correctly and shows a 'Something went wrong!' message. Here is the stack trace.
react.development.js:1465 Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
I think I know why; React is incorrectly a dependency in argo-ui
versus a peerDependency
that it should be since React expects there to be a single version on a given page (https://github.com/facebook/react/issues/13991). We should likely migrate to using a peerDependency
for react
and react-dom
and allow the decision for exactly what version to load be made by the consumers (in this case, argo and argo-cd).
Confirmed it is a React version mismatch. I updated the React version on argo-cd side to match what argo-ui was using, and the page rendered correctly.
Down the dependency rabbit hole I go :). There are larger problems with dependencies than just React, I'm currently working my way through them. If we need to get this fixed in the short term (read: less than a day, I hope to get a proposed fix quickly), then I'd suggest we revert the type fix PR.
As an example, argo-cd
uses but does not declare a dependency on rxjs
, and that started causing issues when I fixed the dependency on React
. I'm hoping to work my way through all of this relatively quickly, but it might take me a day or two since I need to make sure I also don't break Argo Workflows at the same time.
PR updated to move React
to a peerDependency and confirmed that both Argo and Argo-CD build when my branch is used as the target for that. Most of the typing errors I was experiencing was due to testing it by using yarn add file:../argo-ui
which resulted in type errors when compiling - not really sure why.
There are still most definitely problems with how the dependencies are set up that I'll try to work my way through, but I don't think those fixes are required to solve this.
Note that react
and react-dom
should be updated to at least 16.9.3
to match the peerDependency in argo-ui
after my PR in argo-ui is merged. The same is also true in Argo Workflows.
All, and @alexmt, the argo-cd PR that will pull in the latest changes from argo-ui, including the above refactor-type and peerDependency changes, is https://github.com/argoproj/argo-cd/pull/4909. All checks have passed. The PR also includes the updates to the react
and react-dom
versions (See package.json and yarn.lock files). I've tested the UI manually, created a project and sync-ed successfully. The application list page did render properly.
However, during my investigation, I came across an issue. The application list page populated but the filter on the left (or top) failed to render with the following error. Note, I cannot reproduce this problem with the latest changes in the PR. Please give it a try to see if you can reproduce.
main.204346fd671ab36d1385.js:131814 Uncaught (in promise) TypeError: callback is not a function
at flushFirstCallback (main.204346fd671ab36d1385.js:131814)
at flushImmediateWork (main.204346fd671ab36d1385.js:131876)
at unstable_runWithPriority (main.204346fd671ab36d1385.js:131968)
at runWithPriority$1 (main.204346fd671ab36d1385.js:79269)
at flushSyncCallbackQueueImpl (main.204346fd671ab36d1385.js:79314)
at flushSyncCallbackQueue (main.204346fd671ab36d1385.js:79302)
at scheduleUpdateOnFiber (main.204346fd671ab36d1385.js:89429)
at Object.enqueueSetState (main.204346fd671ab36d1385.js:80869)
at DataLoader../node_modules/react/cjs/react.development.js.Component.setState (main.204346fd671ab36d1385.js:101757)
at DataLoader../node_modules/argo-ui/src/components/data-loader.tsx.DataLoader.handleError (main.204346fd671ab36d1385.js:2336)
Running UI with changes from https://github.com/argoproj/argo-cd/pull/4909 locally. I cannot reproduce the issue as well. Even if issue happens again we have time to fix in 1.9. I think we should merge https://github.com/argoproj/argo-cd/pull/4909.
Thanks @alexmt, closing this issue since the original problem (build failure and follow-on issue that the page is not rendering) has been resolved. We should open a new issue for any new problems we find.
If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.
Checklist:
argocd version
.Describe the bug
ArgoCD fails to build if you pull in the latest from argo-ui. One of the errors is due to a missing ? on the
input
property in data-loader.tsxTo Reproduce
Get the latest argo-ui and argo-cd in your dev environment and build argo-cd.
You will see several errors including:
For the first error, the
input
property should still be optional (? mark is missing). See: https://github.com/argoproj/argo-ui/pull/72/files# src/components/data-loader.tsxExpected behavior argo-cd "should" build cleanly if I want to pull in the master (or release) branch of argo-ui ( https://github.com/argoproj/argo-cd/issues/4578 ) and if there are no corresponding dependency changes on the argo-cd side.
Version Grab the latest from argo-ui and argo-cd