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 save a content type using Strapi admin panel UI in 3.1.0 #7139

Closed
ralphsomeday opened this issue Jul 23, 2020 · 11 comments · Fixed by #7155
Closed

Cannot save a content type using Strapi admin panel UI in 3.1.0 #7139

ralphsomeday opened this issue Jul 23, 2020 · 11 comments · Fixed by #7155

Comments

@ralphsomeday
Copy link
Contributor

Describe the bug
Upgraded to 3.1.0 and tried to update a record in one of my content types but when I am trying to save nothing happens the UI does not react to the action and the server is not receiving any call from the admin panel. Also when resetting a boolean to false is says value is required.

Steps to reproduce the behavior

  1. Go to 'Strapi admin panel
  2. Click on 'any content type and edit a field
  3. Try to save
  4. Nothing happens and you can't save

Expected behavior
Edit a content type works

System

  • Node.js version: v12
  • Strapi version:3.1.0
  • Operating system: Mac OS
@alexandrebodin
Copy link
Member

Hi ! Have you rebuild your admin panel ?

@ralphsomeday
Copy link
Contributor Author

Yes I did, can't you reproduce?

@alexandrebodin
Copy link
Member

Nope, I can save any content type

@ralphsomeday
Copy link
Contributor Author

Seems like reseting number fields to 0 or boolean to false is reseting the form to a null value. See link to video: https://www.loom.com/share/1a692e3a9054416aa79d8145e095a9c2

@derrickmehaffy
Copy link
Member

Seems like reseting number fields to 0 or boolean to false is reseting the form to a null value. See link to video: https://www.loom.com/share/1a692e3a9054416aa79d8145e095a9c2

I wasn't able to reproduce this. @ralphsomeday is your source code for your project public somewhere?

@soupette
Copy link
Contributor

@ralphsomeday I am not able to reproduce either can you show us your content type structure?

@ralphsomeday
Copy link
Contributor Author

{
  "kind": "collectionType",
  "collectionName": "timeslots",
  "info": {
    "name": "Timeslot"
  },
  "options": {
    "increments": true,
    "timestamps": true
  },
  "attributes": {
    "label": {
      "type": "string",
      "required": true
    },
    "fromTimeHours": {
      "type": "integer",
      "default": 0,
      "required": true
    },
    "fromTimeMinutes": {
      "type": "integer",
      "default": 0,
      "required": true
    },
    "toTimeHours": {
      "type": "integer",
      "default": 0,
      "required": true
    },
    "toTimeMinutes": {
      "type": "integer",
      "default": 0,
      "required": true
    }
  }
}

@derrickmehaffy
Copy link
Member

@ralphsomeday can you see if you are using any custom extensions (the extensions directory at the root of your project. We had another issue reported that was caused by some custom extensions to the content-manager package.

@ralphsomeday
Copy link
Contributor Author

@derrickmehaffy I have an extension to the users-permissions but not the content-manager.

@ralphsomeday
Copy link
Contributor Author

Hi guys, @derrickmehaffy @alexandrebodin still stuck even with 3.1.1, any chance you guys have time to look into that issue as I can't use the admin panel and therefore can't upgrade. thanks

@ralphsomeday
Copy link
Contributor Author

The extension that i have on user-permissions mainly in the settings.json and overriding the jwt token function

{
  "kind": "collectionType",
  "connection": "default",
  "collectionName": "users-permissions_user",
  "info": {
    "name": "user",
    "description": ""
  },
  "options": {
    "timestamps": true
  },
  "attributes": {
    "username": {
      "type": "string",
      "minLength": 3,
      "unique": true,
      "configurable": false,
      "required": true
    },
    "email": {
      "type": "email",
      "minLength": 6,
      "configurable": false,
      "required": true
    },
    "provider": {
      "type": "string",
      "configurable": false
    },
    "password": {
      "type": "password",
      "minLength": 6,
      "configurable": false,
      "private": true
    },
    "resetPasswordToken": {
      "type": "string",
      "configurable": false,
      "private": true
    },
    "confirmed": {
      "type": "boolean",
      "default": false,
      "configurable": false
    },
    "blocked": {
      "type": "boolean",
      "default": false,
      "configurable": false
    },
    "role": {
      "model": "role",
      "via": "users",
      "plugin": "users-permissions",
      "configurable": false
    },
    "profilePicture": {
      "model": "file",
      "via": "related",
      "plugin": "upload",
      "required": false
    },
    "firstName": {
      "type": "string"
    },
    "lastName": {
      "type": "string"
    },
    "cars": {
      "via": "drivers",
      "collection": "car"
    }
  }
}

services/jwt.js

'use strict'

/**
 * Jwt.js service
 *
 * @description: A set of functions similar to controller's actions to avoid code duplication.
 */

const _ = require('lodash')
const jwt = require('jsonwebtoken')

// by default the jwt token expiration is set to 120 minutes
const defaultJwtExpireseInValue = '120m'

module.exports = {
  issue: (payload, jwtOptions = {}) => {
    _.defaults(jwtOptions, { expiresIn: process.env.JWT_TOKEN_EXPIRES_IN || defaultJwtExpireseInValue })
    return jwt.sign(
      _.clone(payload.toJSON ? payload.toJSON() : payload),
      process.env.JWT_SECRET || _.get(strapi.plugins['users-permissions'], 'config.jwtSecret') || 'oursecret',
      jwtOptions
    )
  }
}

soupette added a commit that referenced this issue Jul 24, 2020
Signed-off-by: soupette <cyril.lpz@gmail.com>
@soupette soupette mentioned this issue Jul 24, 2020
alexandrebodin added a commit that referenced this issue Jul 24, 2020
gilfernandes pushed a commit to onepointconsulting/strapi that referenced this issue Aug 13, 2020
Signed-off-by: soupette <cyril.lpz@gmail.com>
Signed-off-by: Gil Fernandes <gil.fernandes@onepointltd.com>
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.

4 participants