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

undo textarea #2030

Merged
merged 6 commits into from Feb 21, 2022
Merged

undo textarea #2030

merged 6 commits into from Feb 21, 2022

Conversation

filipesilva
Copy link
Collaborator

  • rfct: add a few e2e utils
  • feat: use the same undo for local and remote
  • test: add undo e2e
  • fix: always use athens undo/redo
  • rfct: remove old single player undo

@vercel
Copy link

vercel bot commented Feb 18, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/athens-research/athens/GGrKQFtS6vG5HKJYAmEEVBfLKMBg
✅ Preview: https://athens-git-fork-filipesilva-undo-textarea-athens-research.vercel.app

@@ -1,212 +0,0 @@
(ns athens.common-events.left-sidebar-test
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happened 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 think we refactored these events into atomic events, disabled the test here, and never deleted it. I only found it because I removed the .resolve ns due to removing undo.

await page.keyboard.press(undoShortcut);

// Last block should be gone.
await expect(page.locator('.block:has-text("one")')).toBeVisible();
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is expect async here? I thought this would have to be written as

expect(await page.locator('.block:has-text("one")')).toBeVisible();

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 think the expectation itself is async, because I know it can wait a certain amount of time for it to be or not be visible. If the locator itself was the async part here, I don't think it could wait to be visible (e.g. it would return the locator immediately and then the expectation could only tell if it was visible or not at that point).


export const goToDailyPages = async (page:Page) => {
// The sixth button is the daily notes button.
// TODO: find a better way to address this button, maybe tooltip?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we could CSS classes to the Typescript components and select them that way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Usually for e2e we're looking at things a user could see in some way. A CSS class doesn't fit the bill, but a particular icon, text, or tooltip text does. If all else fails though, it'd have to be a CSS class or ID.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great explanation!

// Wait for an element that signals the app has finished loading.
// Normally on e2e tests we'd load a page, but on a electron app we should rely
// only on visible behaviour.
// TODO: This isn't necessary on production builds, but is necessary for dev
Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense to me

@tangjeff0
Copy link
Collaborator

What's needed to get :editing/uid to get set as well after undo/redo?

@tangjeff0
Copy link
Collaborator

tangjeff0 commented Feb 21, 2022

Also, if user undos after creating and navigating to a page, they are left with an empty page. Should they go back to their previous page? Should a user be able to undo content that is on another page, even if they aren't on that page when they undo?

There's a more general problem here of how to undo/redo not just datascript state but also DOM state:

  • cursor focus
  • page navigation
  • scroll
  • (what else)?

Seems hard :) https://twitter.com/steveruizok/status/1495317652046290944

@tangjeff0 tangjeff0 mentioned this pull request Feb 21, 2022
@filipesilva
Copy link
Collaborator Author

We probably need some guardrails around large undo effects, stuff like deleting a whole page or moving like 40 blocks. Think that's out of scope of this PR though.

Unsure what concretely we need to do to set the cursor on the right place, but I am sure it's doable with what we have right now. We need to have a stronger concept of "block to focus", and save it on the undo/redo stack.

@filipesilva filipesilva merged commit d59ab43 into athensresearch:main Feb 21, 2022
@filipesilva filipesilva deleted the undo-textarea branch February 21, 2022 17:15
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