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

Stop dev menu being accessed as a viewer #3968

Merged

Conversation

willhuang1997
Copy link
Collaborator

No description provided.

frontend/src/App.tsx Outdated Show resolved Hide resolved
Comment on lines 659 to 670
const props = {
...getProps({
s4aCommunication: {
currentState: {
items: [],
queryParams: "",
forcedModalClose: false,
isOwner: false,
},
},
}),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I don't think you need to copy the object so many times:

const props = getProps(...)

is equivalent here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just needed to change the isOwner in s4aCommunication -> currentState to false because I set getProps to be true or am I missing the meaning of your comment? I can get rid of items, queryParams, forcedModalClose though?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think you can also get rid of items, queryParams, etc, but what I was trying to get at is that you can write this as

const props = getProps({
  s4aCommunication: {
    currentState: {
      isOwner: false,
    },
  }
})

since destructuring the return value of getProps to copy it again doesn't change anything

frontend/src/App.test.tsx Outdated Show resolved Hide resolved
frontend/src/App.test.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@vdonato vdonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Comment on lines +671 to +676
delete window.location
window.location = {
assign: jest.fn(),
host: "testing.com",
href: "testing.com",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this currently matters, but you may want to wrap these two tests in a new describe, then do this in a beforeAll (and also save the original value of window.location and restore it in an afterAll) to guarantee that changing it here doesn't affect any other tests

@willhuang1997 willhuang1997 merged commit b675a5e into streamlit:develop Oct 26, 2021
@willhuang1997 willhuang1997 deleted the 3867/fix_hamburger_key_press branch October 26, 2021 21:59
tconkling added a commit that referenced this pull request Nov 1, 2021
* develop:
  * Add ability to access secrets by attribute notation. (#3915)
  Update README (#3948)
  Ensure that session_state.filtered_state can handle missing metadata (#3970)
  Stop dev menu being accessed as a viewer (#3968)
  Implement fail loudly for Bokeh when Bokeh version does not match (2.4.1) (#3966)
  Bump jquery-ui from 1.12.1 to 1.13.0 in /frontend (#3971)
  Try using slightly newer Python 3.7 image (#3967)
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 this pull request may close these issues.

None yet

2 participants