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

Time Units don't load correctly, causing error with time input (WORKAROUND) #13

Open
pospi opened this issue Apr 20, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pospi
Copy link
Collaborator

pospi commented Apr 20, 2023

You will hit this upon attempting to run the app locally due to unfinished standardisation work in the VF protocol regarding the querying and retrieval of Units.

Until then, the below can be used to overwrite ui/node_modules/@valueflows/vf-graphql-holochain/queries/unit.js after NPM modules have been installed:

/**
 * Top-level queries relating to Unit
 *
 * @package: HoloREA
 * @since:   2019-09-12
 */
import { mapZomeFn } from '../connection.js';
export default (dnaConfig, conductorUri) => {
    const readOne = mapZomeFn(dnaConfig, conductorUri, 'specification', 'unit', 'get_unit');
  const readOneBySymbol = mapZomeFn(dnaConfig, conductorUri, 'specification', 'unit', 'get_unit_by_symbol')
    const readAll = mapZomeFn(dnaConfig, conductorUri, 'specification', 'unit_index', 'read_all_units');
    return {
        unit: async (root, args) => {
          let res
          try {
            res = await readOne(args)
          } catch (e) {
            try {
              // attempt GUID-based read of Unit based on symbol
              res = await readOneBySymbol({ symbol: args.id })
            } catch (_retried) {
              // throw original (UUID-based) read error if both fail
              throw e
            }
          }
          return res.unit
        },
        units: async (root, args) => {
            return await readAll(args);
        },
    };
};

You will still see conductor errors RE deserialisation of invalid API parameters, but they are now non-fatal as the Units will fallback to being retrieved by symbol.

See also

for context.

@pospi pospi added the bug Something isn't working label Apr 20, 2023
@pospi pospi self-assigned this Apr 20, 2023
@pospi
Copy link
Collaborator Author

pospi commented Jun 22, 2023

There is now a workaround for this implemented as a postinstall script in workaround-vf-units.patch.cjs that should be removed when this is resolved upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: 🆕 New / Future
Development

No branches or pull requests

1 participant