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

Fix ReferenceError: Cannot access 'TwitterApiReadWrite' before initialization #544

Closed

Conversation

devin-ai-integration[bot]
Copy link

@devin-ai-integration devin-ai-integration bot commented Oct 7, 2024

Fix ReferenceError: Cannot access 'TwitterApiReadWrite' before initialization

This pull request addresses the issue #531 where a ReferenceError occurs when accessing 'TwitterApiReadWrite' before initialization in Next.js with Turbo mode enabled.

Changes made

  • Implemented lazy initialization for the TwitterApiReadWrite class.
  • Modified the TwitterApi class to extend TwitterApiBase instead of TwitterApiReadWrite.
  • Changed the readWrite property to an async method that ensures TwitterApiReadWrite is initialized before use.

How to test

  1. Clone this branch and run a Next.js application with Turbo mode enabled.
  2. Use the TwitterApi class to make API calls.
  3. Verify that no ReferenceError occurs when accessing TwitterApiReadWrite.

Additional notes

This solution ensures that TwitterApiReadWrite is initialized when it's first accessed, preventing the ReferenceError in various lifecycle methods and the component body.

Link to Devin run: https://preview.devin.ai/devin/b55d37eda5a34aaaa5809e320711f7d9

This Devin run was requested by Paul-Louis

If you have any feedback, you can leave comments in the PR and I'll address them in the app!

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

Successfully merging this pull request may close these issues.

1 participant