Skip to content

Custom provider doesn't update Store #92

@BogdanScherban

Description

@BogdanScherban

@fzaninotto

Francois, I need in your advice. Could you please help me?

WHAT I WANT TO DO

I created custom form. It is custom because:

  1. Form include a lot of custom elements, which can't be done by React-Admin functionality;
  2. Some values should be calculated automatically

Screenshot from 2019-05-27 11-40-14

When this form is submited, I run request by custom data provider:

    submitForm = data => {
        .....
        // Some actions, calculations etc.
        .....
        const formData = Object.assign({}, data, additionalData);
        if (isCreate) {
            customDataProvider(CREATE, 'vitalsigns', { data: formData });
        } else {
           .......
           // Some actions
            ......
            customDataProvider(UPDATE, 'vitalsigns', { id: id, data: formData });
        }
        history.push('/vitalsigns');
    };

WHERE IS PROBLEM:

Request from the client side to the server side was sent correctly.

But data in Store isn't updated. Values in React-store are the same, which was before form submitting:
Screenshot from 2019-05-27 11-51-46

All other plugins, where we use React-Admin forms (like Allergies), data updates automatically.

Why data in React-store isn't updated automatically?

Could you please help me to find a reason, why data wasn't updated? And how to provide data updating?

My Form:
https://github.com/PulseTile/PulseTile-RA/blob/showcase/src/version/plugins/Vitals/fragments/Form.js

My Custom data Provider:
https://github.com/PulseTile/PulseTile-RA/blob/showcase/src/core/dataProviders/dataProvider.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions