Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: WebtreesDescendantsChart.DescendantsChart is not a constructor #54

Closed
psyco42 opened this issue Jan 9, 2023 · 8 comments

Comments

@psyco42
Copy link

psyco42 commented Jan 9, 2023

I got the following error in the console when I open the page with the module. Nothing is render under the filters.
I have no error in the PHP error log.

VM309:15 Uncaught TypeError: WebtreesDescendantsChart.DescendantsChart is not a constructor

line 46 in module_v4/webtrees-descendants-chart/resources/views/modules/charts/chart.phtml

The "WebtreesDescendantsChart" object isn't in the original webtrees code, and it present only in the magicsunday plugins.

Context
Plugin version 1.4.0
Webtrees version 2.1.15
Tested under PHP 8.0 and 8.1

I migrated from my old to my new server.
I did a copy of the DB and the whole Webtrees directory, then I import it to my new server. More or less a recovery plan from a backup.

Everything works with my new server except for two plugins from Magicsunday. In both cases, I have the same javascript error.

I cannot find the difference between the two servers, which can lead to this bug in the interface. It is a strict copy in terms of files and DB, same PHP extensions.

The two plugins
github.com/magicsunday/webtrees-pedigree-chart/
github.com/magicsunday/webtrees-descendants-chart
Screenshot 2023-01-09 at 22 40 28

@arbor95
Copy link

arbor95 commented Jan 10, 2023

The module_v4/webtrees-descendants-chart/resources/views/modules/charts/chart.phtml has only 25 lines, what is less than 46.
You use the wrong chart.phtml there. That one is from the ....../descendants-chart/chart.phtml!

@magicsunday
Copy link
Owner

As @arbor95 said, something went wrong copying to the new instance. Please try to install the modules again.

@psyco42
Copy link
Author

psyco42 commented Jan 20, 2023

Thanks for your help.

I did a few things to understand my issue better.

First of all, I re-install a fresh setup of webtrees in my same server with a problematic instance. I add the pedigree module, and it works perfectly.

The module directory is clean and working properly in the fresh instance (same server setup, MySQL, webtrees version).

So, I have definitively something corrupted in my instance, but I couldn't figure out what (and why it affects only those two modules).

@arbor95
Copy link

arbor95 commented Jan 20, 2023

"So, I have definitively something corrupted in my instance, but I couldn't figure out what (and why it affects only those two modules)."

So simply delete the two dirs in the module dir and make them fresh!

@psyco42
Copy link
Author

psyco42 commented Jan 20, 2023

Sorry to insist but I did that first, and it didn't help.

A fresh module directory in my fresh webtrees setup works.
A fresh module directory into my existing webtrees instance doesn't.

But I found something very interesting in my initial steps of debugging.

If I open a new page with the generated URL, the chart is displayed normally.
https://github.com/magicsunday/webtrees-pedigree-chart/blob/master/resources/views/modules/pedigree-chart/chart.phtml#L28

So, I would say something is declared on top of it for the script not to work

@psyco42
Copy link
Author

psyco42 commented Jan 21, 2023

In other words, if I manually open data-wt-ajax-url in a new tab, it displays the module correctly.

Screenshot 2023-01-21 at 10 50 04

@magicsunday
Copy link
Owner

So why not using the fresh install? Rename your directory for Backup. Copy fresh stuff in place. Remove the data Directory From your fresh install and copy it over from your Backup. Maybe some file from the webtrees source is corrupted.

@psyco42
Copy link
Author

psyco42 commented Jan 25, 2023

Hi,

I transfer everything to the fresh setup, and everything works.

So, we won't know the root cause but it is definitively not from the module source code itself.

@psyco42 psyco42 closed this as completed Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants