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

toggle-feature and select-feature cause errors reloading the page #147

Open
tuurma opened this issue Apr 20, 2023 · 6 comments · May be fixed by #150
Open

toggle-feature and select-feature cause errors reloading the page #147

tuurma opened this issue Apr 20, 2023 · 6 comments · May be fixed by #150

Comments

@tuurma
Copy link
Member

tuurma commented Apr 20, 2023

Selecting configuration with pb-toggle-feature or pb-select-feature adjusts the URL to include selectors=.... section which prevents the page from being reloaded correctly

Compare

https://teipublisher.com/exist/apps/tei-publisher/test/lelewel1.xml?view=page&norm=off&odd=lelewel

vs

https://teipublisher.com/exist/apps/tei-publisher/test/lelewel1.xml?view=page&norm=on&odd=lelewel&selectors=%5Bobject+Object%5D

@line-o
Copy link
Member

line-o commented Apr 27, 2023

I was able to reproduce the incorrect URL by clicking the "Normalised View" checkbox in the top toolbar.

@line-o
Copy link
Member

line-o commented Apr 28, 2023

I found the code that is responsible for adding the selectors to the URL. It is PbView.toggleFeature(ev).

registry.getState(this) will return the array of selectors among all other properties. These properties are then used in a call to registry.commit() which adds the selectors to the URL.

@line-o
Copy link
Member

line-o commented Apr 28, 2023

By simply removing the selectors from the properties before calling registry.commit() does keep the URL clean and the state can be toggled.

        // shield URL from selectors
        delete properties.selectors

@line-o
Copy link
Member

line-o commented Apr 28, 2023

Side note: Initial toggle states are not picked up properly in the client-side demo.

@line-o
Copy link
Member

line-o commented Apr 28, 2023

The selectors property is sometimes stored in state and sometimes only in channelState from what I gather.

@line-o
Copy link
Member

line-o commented Apr 28, 2023

related #149

line-o added a commit that referenced this issue Apr 28, 2023
@line-o line-o linked a pull request Apr 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants