Skip to content

URL parameters code + remaps share workspace state across windows and overwrite remappings.txt #6993

@ericglau

Description

@ericglau

Describe the bug
When loading Solidity code into Remix via the code URL parameter together with remaps, opening a second contract in a new Remix window appears to reuse shared workspace state across both windows and overwrite remappings.txt.

To Reproduce
Steps to reproduce the behavior:

  1. Open Remix in a new window with a URL that includes an encoded Solidity file in #code=... and a first set of remappings in #remaps=.... Example first URL.
  2. Observe that compile passes, and the file explorer shows the single contract and remappings.txt.
  3. In a separate new window, open Remix again with a different encoded Solidity file and a different set of remappings. Example second URL.
  4. Observe that the second window's compile passes and file explorer looks correct as well.
  5. In the first window, click remappings.txt in the file explorer.
  6. Observe that the first window's remappings.txt has been replaced with the second window's remappings, and the second contract also appears in the first window's workspace.
  7. Observe that the first contract now fails to compile because its remappings are no longer correct.
  8. In the second window, click remappings.txt.
  9. Observe that the first contract also appears there, indicating that both windows are sharing the same workspace state.

Expected behavior
Loading a second contract in another Remix window with a different remaps payload should not overwrite remapping state in a way that breaks compilation for the first contract.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Brave
  • Version: 2.0.2

Additional context
Relates to #6454

The single-launch flow works correctly, but after loading two contracts with different remapping sets in separate Remix windows, opening remappings.txt in either window reveals shared workspace state and the first contract can stop compiling.

The docs for loading Solidity code via code suggest that this flow uses a code-sample workspace, so it is not clear whether the current behavior is intended or whether there is a recommended way to avoid remappings.txt collisions:
https://remix-ide.readthedocs.io/en/latest/locations.html#load-a-solidity-file-in-the-editor-via-an-encoded-base64-string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions