SolidOS / SolidOS/solid-ui

Only first Option is displayed if form depends on custom attribute

Open
#248 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
153
Forks
46
Avg merge
1d 8h
Merged PRs (30d)
7

Description

Consider the following code:

const container = document.getElementById('div-optionsFieldDependingOn')
      const already = {}
      const subject = UI.rdf.namedNode('http://example.com/#this')
      const exampleOptionsField = UI.rdf.namedNode('http://example.com/#exampleOptionsField')
      const store = UI.rdf.namedNode('http://example.com/#store')
      const callbackFunction = (ok, errorMessage) => {
        console.log(ok, errorMessage, document.getElementById('div-optionsFieldDependingOn').innerHTML);
      }

      // This form depends on colour:
      UI.store.add(exampleOptionsField, UI.ns.ui('dependingOn'), UI.rdf.namedNode('http://example.com/#persona'), UI.rdf.namedNode('http://example.com/'))
      
      // UI to display in case subject is blue:
      UI.store.add(exampleOptionsField, UI.ns.ui('case'), UI.rdf.namedNode('http://example.com/#if-subject-is-developer'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#if-subject-is-developer'), UI.ns.ui('for'), UI.rdf.namedNode('http://example.com/#developer'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#if-subject-is-developer'), UI.ns.ui('use'), UI.rdf.namedNode('http://example.com/#ui-for-developers'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#ui-for-developers'), UI.ns.rdf('type'), UI.ns.ui('Comment'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#ui-for-developers'), UI.ns.ui('contents'), '[UI for developers]')
      
      // UI to display in case subject is red:
      UI.store.add(exampleOptionsField, UI.ns.ui('case'), UI.rdf.namedNode('http://example.com/#if-subject-is-power-user'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#if-subject-is-power-user'), UI.ns.ui('for'), UI.rdf.namedNode('http://example.com/#power-user'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#if-subject-is-power-user'), UI.ns.ui('use'), UI.rdf.namedNode('http://example.com/#ui-for-power-users'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#ui-for-power-users'), UI.ns.rdf('type'), UI.ns.ui('Comment'))
      UI.store.add(UI.rdf.namedNode('http://example.com/#ui-for-power-users'), UI.ns.ui('contents'), '[UI for power users]')

      // Subject is both a developer and a power user, so it should display both [UI for developers] and [UI for power users]
      // but see 
      UI.store.add(subject, UI.rdf.namedNode('http://example.com/#persona'), UI.rdf.namedNode('http://example.com/#developer'), UI.rdf.namedNode('http://example.com/'))
      UI.store.add(subject, UI.rdf.namedNode('http://example.com/#persona'), UI.rdf.namedNode('http://example.com/#power-user'), UI.rdf.namedNode('http://example.com/'))
      
      // FIXME: https://github.com/solid/solid-ui/issues/239
      document.outlineManager = {
        appendPropertyTRs: () => {}
      }
      const result = UI.widgets.field[UI.ns.ui('Options').uri](
        document,
        container,
        already,
        subject,
        exampleOptionsField,
        store,
        callbackFunction
      )

You would expect it to display both the developer and the power user UI but it only displays one of them, at random.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Options widget entry point, UI.widgets.field[UI.ns.ui('Options').uri], and run the reproduction in the issue with a subject having both developer and power-user values. Trace how the dependingOn cases are selected; done means both [UI for developers] and [UI for power users] are displayed consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.