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

Question: Inheritance Uncaught ReferenceError: can't access lexical declaration 'BASE_MODEL_NAME' before initialization #786

Open
pwfraley opened this issue Sep 29, 2022 · 0 comments

Comments

@pwfraley
Copy link

Moin :)

I use vuex-orm (latest version) on a large quasar project and am using STI. Now with some of the models I do get strange errors when using inheritance.

For example:

Client
Company inherits from Client
Court inherits from Company

Now for whatever reason I get errors about accessing Court before Client is defined, but I do not get this error on Company.

I do have a discriminator field (entity framwork core default field for STI)

I have the:

  static typeKey = 'discriminator'
  static types () {
    return {
      Company: Company,
      DistrictCourt: DistrictCourt,
      Person: Person
    }
  }

On one other case I have a MasterData and at least 20 Models who inherit from MasterData. Here I am also seeing this error:

Uncaught ReferenceError: can't access lexical declaration 'MasterData' before initialization

I do believe I have done everything that is described in the docs, and for less complex models it seems to work fine. The only difference I see is that in the documentation it looks like all inherited models are defined in the same file as the basemodel, is this a requirement?

In the store/index.js I am making sure that the base models are always loaded and registered first before the inherited models get loaded and registered.

Am I doing something I should not do here?

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

1 participant