Premium support for our pure JavaScript UI components


Post by peterjc »

Hi, after upgrading to 5.3.6, I now get the following error when I have a dependency between 2 events...

2023-05-30_10-52-37.png
2023-05-30_10-52-37.png (64.07 KiB) Viewed 275 times

My dependency code looks like...

 private addDependencies(eventsToAdd: Array<EvState>): void {
    try {
      this.scheduler.dependencyStore.beginBatch();
      this.scheduler.dependencyStore.removeAll();
      let depId = 1;
      const deps = [];
      for (let ev of eventsToAdd) {
        if (!ev.predecessorIds) {
          continue;
        }
        for (let pred of ev.predecessorIds) {
          const dep = { id: depId++, from: pred, to: ev.id };
          deps.push(dep);
        }
      }
      this.scheduler.dependencyStore.add(deps);
    } catch (error) {
      this.logger.error(`SchedulerDeltaUpdater.addDependencies: ${error}`);
    } finally {
      this.scheduler.dependencyStore.endBatch();
    }
  };

I call this at the same time I add events, and was working fine in 5.2.9.
After this, we have no dependency lines drawn.

Any ideas what could be cauing this?

Thanks in advance


Post by marcio »

Hey peterjc,

Sorry, but no idea what could be causing this with only the snippet that you shared, could you please share a sample project with your configuration and a sample of data for us to check and debug?

You can also check if something changed in the API https://bryntum.com/products/scheduler/docs/api/apidiff but as far as I checked, there wasn't any change related to that function.

Best regards,
Márcio


Post by peterjc »

Hi, ok, so looking closing, I can see what is causing the issue.

If we look at the line in question... ie

const proxyElement = (_a2 = this.client.features.eventDrag) == null ? void 0 : _a2.getProxyElement(assignment);

We can see that is is looking at the value of this.client.features.eventDrag. If this is not null then it tries to call _a2.getProxyElement(assignment) which is the exception we get.

In my case, I have the following in my markup...

2023-05-31_10-22-51.png
2023-05-31_10-22-51.png (17.84 KiB) Viewed 229 times

So this.client.features.eventDrag is not equal to null, but is equal to false, so it is trying to call
false.getProxyElement(assignment); and hence the exception.

If I remove the [eventDragFeature]="false" then I no longer get the exception and the dependeny line is then drawn. However, in our app we want to disable the drag, so won't want to remove this.

I have attached an updated example from your Ionic example where I have changed it so to emulate how I am building / adding the events, resources and dependencies, i.e. all in code and as a result of a service call. Run this via ionic serve.

To emulate this result coming in "later", click on the "Add Data" button, and this calls addDataClick() in home.page.ts.

A weird thing here is that, in the example, even is I remove the [eventDragFeature]="false", when the dependency is added in the code, I don't see the dependency line being drawn, so I am not sure why this is? In my actual app, as long as I remove the [eventDragFeature]="false" I DO see the dependency line when adding in in code as I do in the example.

Note, in the example, if I manually draw the dependency, then it DOES show up (as long as [eventDragFeature]="false" is not in the html), so not sure why in the case adding it in code it does now show.

Also, in the example if I add back the [eventDragFeature]="false" then I never get the dependency drawn. When I add it manually, I see the same error

Unhandled app exception!: Uncaught TypeError: _a2.getProxyElement is not a function
home.page.ts:78
Uncaught TypeError TypeError: _a2.getProxyElement is not a function

So the extra question is why the dependency is not being drawn when added in code in the example?

However, we CAN reproduce the issue at hand by

  1. Adding [eventDragFeature]="false" to the mark up
  2. And then manually adding the dependency

Cheers

Attachments
ionic-4-dependency issue.zip
(617.04 KiB) Downloaded 20 times

Post by alex.l »

Thank you for clarifications! I reproduced this problem and opened a ticket to fix that https://github.com/bryntum/support/issues/6908

All the best,
Alex


Post by peterjc »

Thankyou Alex!


Post Reply