Hello, when we try using tables with https://github.com/adazzle/react-data-grid api the Forge App installs fine but when tried the app the console says Uncaught type errors: N.current is null…
I wonder what is the reason, as if we try it plain as a plain React app it works with no problems and this is givin us a headache. Is it scope issue or what?
Our demo example:
import React, { useEffect, useState } from 'react';
import { invoke } from '@forge/bridge';
import 'react-data-grid/lib/styles.css';
import DataGrid from 'react-data-grid';
const columns = [
{ key: 'id', name: 'ID' },
{ key: 'title', name: 'Title' }
];
const rows = [
{ id: 0, title: 'Example' },
{ id: 1, title: 'Demo' }
];
function App() {
const [data, setData] = useState(null);
useEffect(() => {
invoke('getText', { example: 'my-invoke-variable' }).then(setData);
}, []);
return (
<div>
{data ? data : 'Loading...'}
<DataGrid columns={columns} rows={rows} />
</div>
);
}
export default App;
I created an app where the only differences was the imports
import DataGrid from "react-data-grid";
import "react-data-grid/dist/react-data-grid.css";
Also using dependency "react-data-grid": "7.0.0-canary.30",
manifest
modules:
confluence:homepageFeed:
- key: react-data-grid-homepage-hello-world
resource: main
resolver:
function: resolver
title: react-data-grid
description: A hello world homepage feed.
viewportSize: small
function:
- key: resolver
handler: index.handler
resources:
- key: main
path: static/hello-world/build
app:
id: ari:cloud:ecosystem::app/...
I’m able to display the grid fine.
If you’re still facing issues would you be able to describe the steps you used to recreate the issue?
Sure will report if this works.
No still not work, Im running Windows and Powershell
Steps to produce:
- forge create test /// custom ui global page
- add source to app.js
- npm install
- static/hello world/npm install
- npm install react-data-grid
- static/hello world/npm run build
- forge deploy
- forge install
your imports did not work with me on windows. react-data-grid has n-current: null errors
On Windows react-data-grid npm module folder dont have ‘dist’ -folder so your import did not work with compiler.
As a sanity check you modified the package.json
to change the version
from
"react-data-grid": "^7.0.0-beta.20",
to
"react-data-grid": "7.0.0-canary.30",
before step 6 right?
Yes now tested to change those lines both lock and normal pacage.json still no work
I’ll try on a windows machine now. I’ve been working on mac.
Will let you know what I see
Which module are you using?
npm install react-data-grid
Apologies,
Your Forge modules should appear in the manifest.yml
.
Which ones are you using?
modules:
jira:globalPage:
- key: demo2-hello-world-page
resource: main
resolver:
function: resolver
title: demo2
function:
- key: resolver
handler: index.handler
resources:
- key: main
path: static/hello-world/build
Actually our progress is haulted by this error as we are changing from vanilla EXT grids to opensource library to display our grids.
I’m really scratching my head here. I ran your process on Windows successfully
I’ll message you to set up a meeting to get you unblocked.
Right after the meeting it was revealed the react-data-grid
dependency was being installed on the project’s package.json
rather than the one in static/hello-world
.
Running npm install react-data-grid@7.0.0-canary.30
inside the static/hello-world
folder solved the problem.
I wanna thank you a lot for quick meeting to solve the issue. Our team thank you so much!
1 Like