Skip to content

fix: prevent circular reference && Cannot access … before initialization - #9111

Merged
NathanWalker merged 2 commits into
NativeScript:masterfrom
Akylas:circular_reference
Dec 30, 2020
Merged

NathanWalker merged 2 commits into
NativeScript:masterfrom
Akylas:circular_reference

Conversation

@farfromrefug

Copy link
Copy Markdown
Collaborator

I am not sure why i dont see the issue in all apps but the issue is definitely there:

  • Page imports Frame
  • Frame imports Page
    I ended up in a case where i got Cannot access … before initialization because of that.
    By using frame.constructor.name === 'Frame' now Frame is just used as a type in page-common and thus we dont get a circular referecence anymore

@cla-bot cla-bot Bot added the cla: yes label Dec 24, 2020
@NathanWalker

NathanWalker commented Dec 30, 2020 •

Copy link
Copy Markdown
Contributor

Thanks @farfromrefug we can further enforce/ensure only the type is imported by also doing this at the top:

import type { Frame } from '../frame';

If you'd like to make that one last additional improvement we'll get this merged and out in a patch.

@NathanWalker
NathanWalker merged commit 9a380cd into NativeScript:master Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants