Default config values are not being used
If I don't provide any config values the default values are not being used.
Expected result
Use the following config values:
{
authToken: "be270cae-1c77-4853-b8c1-30b6cf5e9878",
api: "http://localhost:5000",
lfs: "http://localhost:5001", // Feel free to modify this
organizationId: "myorg",
datasetId: "data-test-2",
}
Actual result
{
api: null,
authToken: null,
datasetId: "test-id",
lfs: null,
organizationId: null,
}
Looks like you're setting one of the config vars but missing others.
@mariorodeghiero
Probaly the default props didn't work because of the last changes and the code below:
// Mount the ResourceEditor app explicitly
// (make sure you call the function after it's loaded)
function mountResourceEditorApp([elementId, config, resource] = ['root', {
authToken: null,
api: null,
lfs: null,
organizationId: null,
datasetId: null
}, {}]) {
ReactDOM.render(
<React.StrictMode>
<App config={config} resource={resource} />
</React.StrictMode>,
document.getElementById(elementId)
);
};
// Automatically mount the app if an element with id='ResourceEditor' exists
const element = document.getElementById('ResourceEditor');
if (element) {
const config = {
datasetId: element.getAttribute('data-dataset-id'),
api: element.getAttribute('data-api'),
lfs: element.getAttribute('data-lfs'),
authToken: element.getAttribute('data-auth-token'),
organizationId: element.getAttribute('data-organization-id')
}
The datasetId is already set in index.html file because of this you are receiving test-id, I'll focus on multiple files for while, but @kmanaseryan if you need this config, you can edit in index.html with the config below:
<div id="ResourceEditor" data-api="http://localhost:5000" data-lfs="http://localhost:9419" data-auth-token="XXXX-XXXX-XXXX-XXXX" data-dataset-id="data-test-2" data-organization-id="myorg"></div>
@mariorodeghiero yea not a big deal, it was easy to find a workaround, just saw and wanted to open an issue for later improvements