[SOLVED] Springbot 2.3.0.0 Routing on Crud list

Hi recently our KMS Web apps upgraded to version 2.3.0.0 of Springbot.
we faced some issues with this version. Mainly the problem was found on routing and crud list data.

the crud list data was not loaded until I fired a refresh on the browser then the data is showing again.
and then the create button when we don’t use this code below, it’s adding crud list header to the crud edit. We still cannot find any solutions to this issue.

<!-- % protected region % [Modify the configuration for crud component with id 5ce87e1e-a3dd-41c8-8fe1-10ab3947f11d here] on begin -->
<cb-patient-general-info-crud
	[singlePageComponent]="false"
	id="crud-5ce87e1e-a3dd-41c8-8fe1-10ab3947f11d">
<!-- % protected region % [Modify the configuration for crud component with id 5ce87e1e-a3dd-41c8-8fe1-10ab3947f11d here] end -->
</cb-patient-general-info-crud>

May you can help us with this issue on KMS Web projects

Regards,

Virgananta

1 Like

Hi Virgananta!

Just letting you know that we have seen your request and I am making sure that one of our dev team members will get back to you as soon as they have a response.

Cheers,
Tessa

Hi @Virgananta_Nugraha, thanks for getting in touch!

To help us trouble shoot this issue, can you please add a screen recording demonstrating this issue or if you don’t want to add it here you can email it to us at support@codebots.com.

Hi @Virgananta_Nugraha, we’ve started having a look into some of the issues you’re having, and believe we’ve found a solution to one of the issues you ran into. Please note that this is a potential solution for the error you had when trying to click the cards on the system configuration page, and we are still investigating your other issues.

This error is caused in Angular 11 by the relativeTo parameter which can be passed into Routing actions, so if you have some routing actions which use this parameter in your custom code that would cause this error in the console. To fix this, you need to build the routes out in your routing actions, instead of using the relativeTo parameter. As an example, in bot written code, routing within admin section crud tiles has changed from this:

commands.push('fish');

if (tileMode !== CrudTileMode.List) {
	commands.push(tileMode.toString());
}

if (id) {
	commands.push(id);
}
this.routerStore.dispatch(new routingAction.NavigateRoutingAction(commands, {
	queryParams: {listPage: this.pageIndex + 1},
	relativeTo: this.activatedRoute.parent, // route in this instance was /admin/entities/fish, so the parent route was /admin/entities
}));

to this:

commands.push('admin');
commands.push('entities');
commands.push('fish');

if (tileMode !== CrudTileMode.List) {
	commands.push(tileMode.toString());
}

if (id) {
	commands.push(id);
}
this.routerStore.dispatch(new routingAction.NavigateRoutingAction(commands, {
	queryParams: {listPage: this.pageIndex + 1},
}));

There is information about this issue in the release notes for Springbot v2.3.0.0 as well. If this issue persists after making these changes please let us know!

https://forum.codebots.com/t/springbot-release-2-3-0-0

2 Likes

Hi @Virgananta_Nugraha,

I believe I have found the cause of the remaining issues. As part of the management of immutable state, a library called immer is used.

This library prevents the mutation of any part of that state. What appears to be happening is in a getter method in a model file, an attempt is being made to mutate the state.

For example:

getModelProperty(): Date{
	this.arrayModelProperty.sort((a, b) => {
		...
	}
	this.modelProperty = this.arrayModelProperty[0].attribute;
	return this.modelProperty;
}

This is causing an error to be thrown in Angular that is preventing the data from loading as well as causing some of the render issues you are seeing.

The solution is to create a copy of the arrayModelProperty before attempting to mutate it.

For example:

getModelProperty(): 
	let tempArrayModelProperty = [...arrayModelProperty];
	tempArrayModelProperty.sort((a, b) => {
		...
	}
	this.modelProperty = tempArrayModelProperty[0].attribute;
	return this.modelProperty;
}