Page 1 of 1
[REACT] ResourceAllocationInfo override not working on production build
Posted: Fri Dec 09, 2022 10:22 pm
by tulioassis
Hey!
We are overriding the ResourceAllocationInfo class.
It's working good on a dev server but not on a production build.
On prod build we are able to get the resource histogram template but all the ticks are empty (no color).
Did someone face something similar?
Any ideas on what could be the issue?
Re: [REACT] ResourceAllocationInfo override not working on production build
Posted: Sat Dec 10, 2022 12:58 am
by tulioassis
I did some tests here and seems that generator function cannot be overridden.
Works:
export class ResourceAllocationInfoOverride {
static get target() {
return {
class: ResourceAllocationInfo,
};
}
calculateAllocation() {
alert('Test');
}
}
Does not work:
export class ResourceAllocationInfoOverride {
static get target() {
return {
class: ResourceAllocationInfo,
};
}
*calculateAllocation() {
alert('Test');
}
}
But we do need to keep it as a generator function...
Re: [REACT] ResourceAllocationInfo override not working on production build
Posted: Mon Dec 12, 2022 10:48 am
by arcady
Re: [REACT] ResourceAllocationInfo override not working on production build
Posted: Mon Dec 12, 2022 3:29 pm
by tulioassis
Hey arcady,
That's weird, but this way you provided is not working for me when I use the * (generator function).
Working:
export class ResourceAllocationInfoOverride extends ResourceAllocationInfo {
// @ts-expect-error
calculateAllocation(): CalculationIterator<this['allocation']> {
alert('calculateAllocation test');
}
}
Not working:
export class ResourceAllocationInfoOverride extends ResourceAllocationInfo {
// @ts-expect-error
*calculateAllocation(): CalculationIterator<this['allocation']> {
alert('calculateAllocation test');
}
}
As project model:
projectRef.current = new ProjectModel({
...
// @ts-expect-error
resourceAllocationInfoClass: ResourceAllocationInfoOverride,
});
Re: [REACT] ResourceAllocationInfo override not working on production build
Posted: Mon Dec 12, 2022 4:02 pm
by arcady
Please provide a test case demonstrating the problem and we'll investigate what happens.
Re: [REACT] ResourceAllocationInfo override not working on production build
Posted: Mon Dec 12, 2022 4:10 pm
by tulioassis
Do you know if is it possible to apply overrides on any available demo/example?
Re: [REACT] ResourceAllocationInfo override not working on production build
Posted: Mon Dec 12, 2022 4:38 pm
by arcady
Not sure. I haven't tried to override all of the demos. Why?