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

Forms losing layout in upgrade #1608

Closed
BrandonJamesBorders opened this issue Nov 5, 2024 · 4 comments
Closed

Forms losing layout in upgrade #1608

BrandonJamesBorders opened this issue Nov 5, 2024 · 4 comments
Labels
issue Something isn't working correctly

Comments

@BrandonJamesBorders
Copy link

BrandonJamesBorders commented Nov 5, 2024

What happened?

I upgraded freeform from 5.5.10 to 5.6.8 alongside a craft upgrade from 5.4.3 to 5.4.9.

During the upgrade, all our flexbox forms "lost" their layout setting. Forms using other values were not impacted.

Frontend error:
Screenshot 2024-11-05 at 3 23 56 PM

Form settings:
Screenshot 2024-11-05 at 3 24 07 PM

Resaving the form settings with the value "Flexbox" resolved the frontend error.

I inspected a DB backup and noted that this line is probably the culprit in the freeform_forms table and metadata column.

Before:
"formattingTemplate": "flexbox.twig",

After setting it it becomes:
"formattingTemplate": "flexbox/index.twig",

Freeform Edition

Pro

Freeform Version

5.6.8

Craft Version

5.4.9

When did this issue start?

After upgrading from older Freeform version

Previous Freeform Version

5.5.10

@BrandonJamesBorders BrandonJamesBorders added the issue Something isn't working correctly label Nov 5, 2024
@kjmartens
Copy link
Contributor

I'm sorry this happened @BrandonJamesBorders.

There is a migration that is supposed to take care of this... is there any chance you didn't run the migration before viewing the forms in the front end or form builder? 🙂

@BrandonJamesBorders
Copy link
Author

I don't believe so.

Locally I upgraded via the craft CLI, and it happened there. I did not notice (shame on me) and pushed it to production, the pipeline ran the migrate/all command and finished without errors.

Total 4 new Freeform migrations to be applied:
    - m240813_161214_UpdateStatusColors
    - m240814_120443_RefactorGridAndFlexboxFormattingTemplatePaths
    - m240903_145017_CreateFormGroupsTable
    - m240903_145034_CreateFormGroupsEntriesTable

Backing up the database ... done
*** applying m240813_161214_UpdateStatusColors
*** applied m240813_161214_UpdateStatusColors (time: 0.019s)

*** applying m240814_1204[43](https://github.com/borders-dev/bw-fusion/actions/runs/11690969901/job/32557090788#step:12:44)_RefactorGridAndFlexboxFormattingTemplatePaths
*** applied m240814_120[44](https://github.com/borders-dev/bw-fusion/actions/runs/11690969901/job/32557090788#step:12:45)3_RefactorGridAndFlexboxFormattingTemplatePaths (time: 0.039s)

*** applying m240903_1[45](https://github.com/borders-dev/bw-fusion/actions/runs/11690969901/job/32557090788#step:12:46)017_CreateFormGroupsTable
    > create table {{%freeform_forms_groups}} ... done (time: 0.019s)
    > add foreign key craft_fk_hagbyczufactunnemcxrufdpmirwdjtqzcmq: {{%freeform_forms_groups}} (siteId) references {{%sites}} (id) ... done (time: 0.045s)
*** applied m240903_145017_CreateFormGroupsTable (time: 0.073s)

*** applying m240903_145034_CreateFormGroupsEntriesTable
    > create table {{%freeform_forms_groups_entries}} ... done (time: 0.020s)
    > add foreign key craft_fk_tvxzxjppxuklqkffuygwivrjkqspclazbjyv: {{%freeform_forms_groups_entries}} (groupId) references {{%freeform_forms_groups}} (id) ... done (time: 0.0[48](https://github.com/borders-dev/bw-fusion/actions/runs/11690969901/job/32557090788#step:12:49)s)
    > add foreign key craft_fk_aejdrpxjanoidbivrnshcerewhqjxfoosdyb: {{%freeform_forms_groups_entries}} (formId) references {{%freeform_forms}} (id) ... done (time: 0.054s)
*** applied m240903_14[50](https://github.com/borders-dev/bw-fusion/actions/runs/11690969901/job/32557090788#step:12:51)34_CreateFormGroupsEntriesTable (time: 0.132s)

I restored a snapshot just now and tried to get the error to happen again and was unable to reproduce. 🤷

@kjmartens
Copy link
Contributor

Hmm, that is interesting. So to confirm, you tried duplicating the issue again now but it didn't happen?

I haven't seen this happen to anyone else yet, but I've noted this for us to check into. I'm also thinking we will create a fallback to something like Flexbox in the event a formatting template is missing or invalid. I imagine it would be better to get an incorrectly styled form than a broken page. 🙂

@BrandonJamesBorders
Copy link
Author

That's correct. A fallback would be a smart thing to add!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

2 participants