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

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.

About this issue

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

Most upvoted comments

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

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?

Same issue here, any permanent solution ?

still facing the issue with

@nozbe/watermelondb”: “^0.16.0”, “@nozbe/with-observables”: “^1.0.5”,

I have same issue, anyone can fix it?

@YajanaRao Why did you close the issue?

Also running into this problem with;

    "react-native": "0.63.3",
    "@nozbe/watermelondb": "^0.20.0",
    "@nozbe/with-observables": "^1.0.7",

using Hermes engine on Android,

Same here, still investigating:

"@nozbe/watermelondb": "0.19.0",
"@nozbe/with-observables": "1.0.5"

Also facing this issue with:

"@nozbe/watermelondb": "0.17.1",
"@nozbe/with-observables": "1.0.5",