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

Cannot add blocks from the current template #92

Closed
MathPow opened this issue May 5, 2024 · 2 comments
Closed

Cannot add blocks from the current template #92

MathPow opened this issue May 5, 2024 · 2 comments

Comments

@MathPow
Copy link
Contributor

MathPow commented May 5, 2024

Describe the bug

When we add blocks from the current template, nothing seems to update in the preview but we can see the change in the blocks area. If we select "Add Block" from an other template on the right (with the new feature), it works fine.

To Reproduce

Steps to reproduce the behavior:

  1. Go to othneildrew-best-readme-template
  2. Click on 'Add Block' from any of the option of the right. It needs to be a block from the current template
  3. Scroll down to the bottom of the page
  4. See that nothing updates in the preview

Expected behavior

We want the markedown preview to update in real time everytime

Screenshots

image

@ShaanCoding
Copy link
Owner

I think this is due to the useEffect that generates the template not containing blocks to regenerate it upon adding. As usually on a new block being added a macro is added, which is not the case for duplicate blocks.

Another issue here is they share the same keys, and thus will share the same form values / cause conflicts. As they use global values, we need to uplift #24, or generate new UUID keys on query or just make it 1 block per template as realistically you would never need 2 duplicate sections

@ShaanCoding
Copy link
Owner

To remove this pain point, I'm going to 'fix' this by enforcing 1 unique block per project for now. I'll make a follow-up ticket removing this restriction later

ShaanCoding added a commit that referenced this issue May 7, 2024
- As discussed in #92 removing the option to show duplicate blocks due to key collisions at this time
ShaanCoding added a commit that referenced this issue May 8, 2024
* [Shaan] Prevented Duplicate Blocks (#100)

- As discussed in #92 removing the option to show duplicate blocks due to key collisions at this time

* [Shaan] Preview Template Modal (#101)

* Updated Buttons To ShadCN/UI Tabs

* Added shadcn/ui Alert Dialog

- Added shadcn/ui alert dialog & dialog

* Split up markdown editor & preview page

- Decoupled markdown editor and preview page, as the stylised renderer is needed in > 1 location

* Extended Copy & Download Buttons

* Created PreviewModal

- Created Preview Modal and made Card component accept the property in a grid

* Added Markdown Template Backend API

- Added Markdown Template Backend API

Generated Frontend Types

- Generated Frontend Types to support v1TemplatePreview

* Added Spinner & Dynamic Data - PreviewModal

- Added Spinner Component & Handled Failure on Modal
- Added Failure States & Refactored Preview Modal
- Added Dynamic Querying Logic Instead of Static Component

Split Up Component

- Split up components into one component per item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants