Uploaded image for project: 'Policy Framework'
  1. Policy Framework
  2. POLICY-3600

Some REST calls in Clamp GUI do not include pathname


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Istanbul Release
    • Istanbul Release
    • gui
    • None

      During the implementation of POLICY-3574, it was observed that some REST calls from Clamp GUI do not include the relative pathname (i.e. window.location.pathname).

      The bug, which appears multiple times, is related to the use of React's useState() returning immutable constants for state variables and async functions for setters, with those variables being updated and used within a closure (e.g. from useEffect()) - since React state variables are immutable, the old value gets captured in the closure. This results in incorrect path names in the REST URLs - this breaks the policy-gui Docker image.

      const [windowLocationPathname, setWindowLocationPathname] = useState('');

            danielhanrahan Daniel Hanrahan
            danielhanrahan Daniel Hanrahan
            0 Vote for this issue
            1 Start watching this issue