question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: from.from is not a function. (In 'from.from(observables[0])', 'from.from' is undefined)

See original GitHub issue

Here is my component

const PlaylistItem = ({playlist}) => {
  console.log(playlist);
    return (
    <List.Item
      title={playlist.title}
      description="by you"
      left={props => <List.Icon {...props} icon="audiotrack" />}
    />
  );
};

const enhance = withObservables(['playlist'], ({playlist}) => ({
  playlist
}));

export default enhance(PlaylistItem);

Here is how I call the component

<FlatList
          data={this.state.playlists}
          renderItem={(item) => <PlaylistItem playlist={item} />}
        />

This is my query

async componentDidMount(){
    const playlists = database.collections.get('playlists');
    const allPlaylists = await playlists.query().fetch();
    console.log("playlist ", allPlaylists);
    this.setState({
      playlists: allPlaylists
    })
  }

Please help me. I am not able to understand the problem. If I remove withObservables and export as it is, it is working fine.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
YajanaRaocommented, Sep 27, 2019

The walk around for this issue is to change var from = require('rxjs/observable/from'); to var from = require('rxjs'); in \node_modules\@nozbe\with-observables\dist\with-observables.cjs.js

6reactions
joshfarrantcommented, Feb 12, 2020

Sorry to reopen this discussion, but I was experiencing the same from.from is undefined that @YajanaRao was experiencing.

The solution they proposed (modifying the import in with-observables.cjs.js did resolve the issue, but obviously that’s just a workaround, not a permanent fix.

Are there any suggestions as to what the underlying issue could be, and how that can be resolved? Is it as simple as changing the import, or coudl that have knock-on effects?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Observable_1.Observable.from is not a function - Stack Overflow
I am trying to create a unit test in angular-6. import { TodosComponent } from './todos.component'; import { ...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
48 answers on StackOverflow to the most popular Angular ...
I gathered the most common questions and answers from Stackoverflow. These questions were chosen by the highest score received. Whether you are an...
Read more >
Receiving Uncaught TypeError: self.userName is not a function
Hi Experts, I am a beginner in Ojet and was doing a course. While in Lecture 44 I am receiving below error while...
Read more >
Observables - Knockout.js
Observables. Knockout is built around three core features: Observables and dependency tracking; Declarative bindings; Templating. On this page, you'll learn ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found