building-envelope-data / database

Reference implementation of a product data server as part of the product data network buildingenvelopedata.org
MIT License
0 stars 0 forks source link

Repair deletion of last field of a `Filter.List` #19

Open simon-wacker opened 2 years ago

simon-wacker commented 2 years ago

After adding a field to an empty Form.List, hitting Filter, removing that very field, and hitting Filter again, the value of that last field is passed as variable to the GraphQL query requested by *Query.refetch, although it is not given as parameter to *Query.refetch. This is only a problem when after removing the field the Form.List is empty, that is, there is no other proposition present. The most relevant code snippet is https://github.com/ise621/database/blob/e23f0107668b1da5d2a304d1135c79d4cde6d2e3/frontend/pages/data/optical.tsx#L264-L270

This happens for example on the page /data/optical with Nearnormal hemispherical solar reflectance propositions. To see the actual GrapQL query requested from the server use the Network tab of the Web Developer Tools.

Maybe the following documentations can shed some light on the issue https://www.apollographql.com/docs/react/api/core/ObservableQuery/#ObservableQuery.refetch and https://www.apollographql.com/docs/react/data/refetching/