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

Duplicated Presentation when using mongoose #25

Closed
1beb opened this issue Jul 4, 2017 · 5 comments · Fixed by #26
Closed

Duplicated Presentation when using mongoose #25

1beb opened this issue Jul 4, 2017 · 5 comments · Fixed by #26

Comments

@1beb
Copy link

1beb commented Jul 4, 2017

I have a feathers service that I can test with postman, and it shows a list of 4 records all distinct. However, when I try to use it with aor-feathers-client, no matter which model I use, the records are all being presented as equal. So let's say for example, we have a model for reminders. We would expect:

Reminders List

  • reminder 1
  • reminder 2
  • ...

But what is appearing is:

Reminder List

  • reminder 1
  • reminder 1
  • ...

screenshot 2017-07-04 17 33 46

Where the first item is always duplicated. Also, when trying to edit, it simply passes 'undefined'. I'm not sure what I'm doing wrong here. I based it entirely off of your example:

// App.js

import React from 'react';
import { Admin, Resource, simpleRestClient } from 'admin-on-rest';
import { RemindersList} from './Reminders';
import { restClient } from 'aor-feathers-client'; // authClient for future!
import feathersClient from './feathersClient';

const App = () => (
  <Admin restClient={restClient(feathersClient)}>
    <Resource name="reminders" list={ContactList} />
  </Admin>
);

export default App;

// Contact.js

import React from 'react';
import { Filter, DisabledInput, ReferenceInput, List, Edit, Create, SimpleForm, Datagrid, TextField, SelectInput, TextInput, EditButton } from 'admin-on-rest/lib/mui';

export const RemindersList = (props) => (
    <List {...props}>
        <Datagrid>
            <TextField source="_id" />
            <TextField source="credoId" />
            <TextField source="surveyId" />
            <TextField source="frequency" />
            <TextField source="nextReminder" />
            <EditButton />

        </Datagrid>
    </List>
);

// feathersClient.js

import feathers from 'feathers-client';
import hooks from 'feathers-hooks';
import rest from 'feathers-rest/client';

const host = 'http://localhost:3030';

export default feathers()
  .configure(hooks())
  .configure(rest(host).fetch(window.fetch.bind(window)));

@1beb 1beb changed the title Duplicated Presentation Duplicated Presentation when using mongoose Jul 5, 2017
@1beb
Copy link
Author

1beb commented Jul 5, 2017

This problem appears to be related to the ids, or more specifically the field name of the id (in this case _id). In general, it seems to work if we do not use a mongoose.

@josx
Copy link
Owner

josx commented Jul 5, 2017

is there any errors on browser console or on feathers debug?

@josx
Copy link
Owner

josx commented Jul 5, 2017

check here:

feathersjs-ecosystem/feathers-mongoose#81
feathersjs-ecosystem/feathers-mongoose#156

@fonzarely Is working to support custom id (maybe you want to help)
https://github.com/josx/aor-feathers-client/pull/21

@thngdude
Copy link

I am experiencing this issue as well. Any workarounds?

@josx
Copy link
Owner

josx commented Jul 11, 2017

It seems to be that you are using mongo or somehting with custom id field name.
We are working to support that!
@thngdude if you can please help us!
here WIP https://github.com/josx/aor-feathers-client/pull/21 (need tests, and @1beb told us that it is not working )

@josx josx mentioned this issue Jul 13, 2017
@josx josx closed this as completed in #26 Jul 13, 2017
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 a pull request may close this issue.

3 participants