Skip to content

Custom slots (re-rendering) is re-fetching every options request #62

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

Closed
4 tasks done
jlsjonas opened this issue Feb 28, 2019 · 5 comments
Closed
4 tasks done

Custom slots (re-rendering) is re-fetching every options request #62

jlsjonas opened this issue Feb 28, 2019 · 5 comments
Assignees

Comments

@jlsjonas
Copy link
Contributor

This is (likely) an upstream bug & feature request. (related to this Vue issue)

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

When changing any data in a slot this causes a re-render of the parent (<enso-form>), this is due to Vue behaviour which is fixed only for statically defined slots at this point (see issue above).

The main issue this causes is that all SelectField's are re-fetching their data.

Steps to Reproduce

  1. Have a custom slot that contains changable data (f.e. a sum sourced by the defined select)
  2. Note that changing the value causes all forms to fetch data from the server again

Expected behavior

Updating a simple string not to refetch options of all fields in the form

Actual behavior

All select fields fetch data again, even if no parameters are changes

Suggestion

As this is most likely caused by Vue.js (2.0) behaviour, change the way SelectField fetches data (bubble up?) when used inside an EnsoForm (use the EnsoForm instance as a cache?)
To keep separation, preserve current behaviour if the caching property is unavailable.

I hope there's a better way as I fully understand this can't be ideal, but the limitations caused by the dynamically generated slots regenerating the whole form heavily limits the flexibility, especially when dealing with complex forms.

@aocneanu
Copy link
Member

aocneanu commented Mar 5, 2019

I'll have to reproduce that on the new version

@aocneanu aocneanu self-assigned this Mar 5, 2019
@aocneanu
Copy link
Member

Unable to reproduce it.

@jlsjonas
Copy link
Contributor Author

jlsjonas commented Mar 11, 2019

I'll try to reproduce the issue once the new version is out (non-alpha) and try to pin down the cause if not (though as mentioned in the OP from it's description it seems to be a Vue2.x-related issue

@aocneanu
Copy link
Member

fixed with enso-ui/select@984f44b

@jlsjonas
Copy link
Contributor Author

jlsjonas commented Apr 9, 2019

For anyone stumbling upon this in the future: using object litterals ({ something: '123'}) in params, custom-params, ... is causing vue to assume it's an updated entity on every ui update (since Vue2.x); which was likely the root cause of this issue.

Fix: use computed properties instead

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

No branches or pull requests

2 participants