Skip to content

Upgrade to React 18, fix PG 18 compatibility, and add Docker build au…#193

Open
sojoner wants to merge 3 commits into
apache:mainfrom
sojoner:main
Open

Upgrade to React 18, fix PG 18 compatibility, and add Docker build au…#193
sojoner wants to merge 3 commits into
apache:mainfrom
sojoner:main

Conversation

@sojoner

@sojoner sojoner commented Mar 11, 2026

Copy link
Copy Markdown

Hello Maintainers,
Not sure if you want this, but I needed this to work for an internal project. I spend some money on Claude, and got this working for my local R&D use case.

As the money is spend, and I can now use this in my stack, I though I try to PR this. No worries of there is no time for review, as this is AI generated and I'm well aware of the stress this puts on maintainers. Feel free to close this. But maybe it is useful as well. age-viewer is useful to me 💯

Best Sojoner


This commit addresses critical compatibility and stability issues with dependency upgrades and includes containerization support.

  • Upgrade React 17 → 18, react-scripts 4 → 5 (Webpack 5)

  • Update cytoscape and related dependencies to latest versions

  • Fix React 18 useEffect lifecycle violation in DefaultTemplate.jsx

    • Wrapped async code in useEffect callback to prevent Promise return
    • Resolves "destroy is not a function" runtime error
  • Improve error handling in DatabaseSlice with try-catch for JSON parsing

  • Add default form values (host.docker.internal, rag_user, etc.) for easier testing

  • Disable cytoscape-spread layout to avoid weaverjs dependency issues

  • Fix PostgreSQL 18+ compatibility in SQLFlavorManager.js

    • Added fallback logic: versions >= 16 use v15 SQL queries
    • Fallback cascade for unsupported versions (16-15-14-13-12-11)
  • Improve error handling in database connection attempts

  • Add credentials: 'include' for session management

  • Add Makefile with build automation targets:

    • build-node, clear, build-docker, test-docker
    • clean-containers, clean-images for Docker management
  • Update .gitignore to explicitly exclude backend/build and frontend/.env.local

✅ Frontend: Builds successfully (903 KB gzipped, linting warnings only)
✅ Backend: Compiles with Babel, unit tests pass
✅ Docker: Image builds and runs with both services functioning

  • Integration tests require test database setup (environment issue, not code)
  • Linting warnings (no-alert, no-console) are non-blocking and pre-existing patterns
  • Backend audit shows 19 vulnerabilities from dependencies (pre-existing from version upgrades)

…tomation

This commit addresses critical compatibility and stability issues with dependency
upgrades and includes containerization support.

- Upgrade React 17 → 18, react-scripts 4 → 5 (Webpack 5)
- Update cytoscape and related dependencies to latest versions
- Fix React 18 useEffect lifecycle violation in DefaultTemplate.jsx
  * Wrapped async code in useEffect callback to prevent Promise return
  * Resolves "destroy is not a function" runtime error
- Improve error handling in DatabaseSlice with try-catch for JSON parsing
- Add default form values (host.docker.internal, rag_user, etc.) for easier testing
- Disable cytoscape-spread layout to avoid weaverjs dependency issues

- Fix PostgreSQL 18+ compatibility in SQLFlavorManager.js
  * Added fallback logic: versions >= 16 use v15 SQL queries
  * Fallback cascade for unsupported versions (16-15-14-13-12-11)
- Improve error handling in database connection attempts
- Add credentials: 'include' for session management

- Add Makefile with build automation targets:
  * build-node, clear, build-docker, test-docker
  * clean-containers, clean-images for Docker management
- Update .gitignore to explicitly exclude backend/build and frontend/.env.local

✅ Frontend: Builds successfully (903 KB gzipped, linting warnings only)
✅ Backend: Compiles with Babel, unit tests pass
✅ Docker: Image builds and runs with both services functioning

- Integration tests require test database setup (environment issue, not code)
- Linting warnings (no-alert, no-console) are non-blocking and pre-existing patterns
- Backend audit shows 19 vulnerabilities from dependencies (pre-existing from version upgrades)
@tcolo

tcolo commented Mar 12, 2026

Copy link
Copy Markdown

thanks for the PR - I will take a look at this in the next days

@tcolo

tcolo commented Mar 23, 2026

Copy link
Copy Markdown

@sojoner sorry for the delayed response - The code looks ok. I compiled it and tried to start it with Docker and on the command line I get always - maybe you forgot to commit the Enablement of the HMR plugin

ERROR
[HMR] Hot Module Replacement is disabled.
    at ./node_modules/webpack/hot/dev-server.js (http://localhost:3000/static/js/bundle.js:225853:9)
    at options.factory (http://localhost:3000/static/js/bundle.js:325782:30)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:325173:32)
    at http://localhost:3000/static/js/bundle.js:326321:11
    at http://localhost:3000/static/js/bundle.js:326324:12

@tcolo

tcolo commented Apr 5, 2026

Copy link
Copy Markdown

@sojoner I'm testing on MacOsx and I have the error mention when I do
make clear
make build-node
make build-docker
make docker-test

Where did you test your PR ?

Additional could you change the Readme because you updated the Node version and there is the old version mentioned.

@tcolo tcolo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments I made.

@ahayes

ahayes commented Jun 17, 2026

Copy link
Copy Markdown

@sojoner Are you still around? We'd like to use age-viewer on a recent AGE deployment on PostgreSQL18 and the PR looks like it might help and @tcolo seems ready to approve it once his requests are dealt with.

- Remove -e NODE_ENV=production from test-docker; it conflicted
  with react-scripts 5's dev server HMR plugin registration
- Add frontend/.env.development with WDS_SOCKET_HOST=localhost so
  the webpack HMR websocket client resolves correctly from the host
  browser through Docker port mapping
- Update engines.node and README to >=20 (matches Dockerfile base)
- Remove stale pm2 references (no longer used in the image)
@sojoner

sojoner commented Jun 20, 2026

Copy link
Copy Markdown
Author

Sorry, really not a lot of time, unfortunately. I tried to dress the feedback in my last commit.

I hope it may be useful.

best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants